theta-client-react-native 1.1.0 → 1.3.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/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +647 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +487 -85
- package/ios/ThetaClientReactNative.h +6 -0
- package/ios/ThetaClientReactNative.mm +1675 -181
- package/ios/ThetaClientReactNative.xcodeproj/project.pbxproj +2 -2
- package/lib/commonjs/capture/index.js +11 -0
- package/lib/commonjs/capture/index.js.map +1 -1
- package/lib/commonjs/capture/notify.js +12 -0
- package/lib/commonjs/capture/notify.js.map +1 -0
- package/lib/commonjs/capture/time-shift-capture.js +135 -0
- package/lib/commonjs/capture/time-shift-capture.js.map +1 -0
- package/lib/commonjs/theta-repository/access-point.js.map +1 -1
- package/lib/commonjs/theta-repository/digest-auth.js +2 -0
- package/lib/commonjs/theta-repository/digest-auth.js.map +1 -0
- package/lib/commonjs/theta-repository/index.js +37 -4
- package/lib/commonjs/theta-repository/index.js.map +1 -1
- package/lib/commonjs/theta-repository/options/index.js +198 -0
- package/lib/commonjs/theta-repository/options/index.js.map +1 -1
- package/lib/commonjs/theta-repository/options/option-ai-auto-thumbnail.js +17 -0
- package/lib/commonjs/theta-repository/options/option-ai-auto-thumbnail.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-bitrate.js +64 -0
- package/lib/commonjs/theta-repository/options/option-bitrate.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-burst-mode.js +23 -0
- package/lib/commonjs/theta-repository/options/option-burst-mode.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-burst-option.js +140 -0
- package/lib/commonjs/theta-repository/options/option-burst-option.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-camera-control-source.js +29 -0
- package/lib/commonjs/theta-repository/options/option-camera-control-source.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-camera-mode.js +26 -0
- package/lib/commonjs/theta-repository/options/option-camera-mode.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-capture-mode.js +30 -0
- package/lib/commonjs/theta-repository/options/option-capture-mode.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-continuous-number.js +71 -0
- package/lib/commonjs/theta-repository/options/option-continuous-number.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-filter.js +32 -0
- package/lib/commonjs/theta-repository/options/option-filter.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-network-type.js +26 -0
- package/lib/commonjs/theta-repository/options/option-network-type.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-power-saving.js +24 -0
- package/lib/commonjs/theta-repository/options/option-power-saving.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-preset.js +26 -0
- package/lib/commonjs/theta-repository/options/option-preset.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-preview-format.js +32 -0
- package/lib/commonjs/theta-repository/options/option-preview-format.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-proxy.js +2 -0
- package/lib/commonjs/theta-repository/options/option-proxy.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-shooting-method.js +41 -0
- package/lib/commonjs/theta-repository/options/option-shooting-method.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-shutter-speed.js +302 -0
- package/lib/commonjs/theta-repository/options/option-shutter-speed.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-time-shift.js +43 -0
- package/lib/commonjs/theta-repository/options/option-time-shift.js.map +1 -0
- package/lib/commonjs/theta-repository/options/option-wlan-frequency.js +22 -0
- package/lib/commonjs/theta-repository/options/option-wlan-frequency.js.map +1 -0
- package/lib/commonjs/theta-repository/options/options.js +52 -26
- package/lib/commonjs/theta-repository/options/options.js.map +1 -1
- package/lib/commonjs/theta-repository/theta-config.js +6 -0
- package/lib/commonjs/theta-repository/theta-config.js.map +1 -0
- package/lib/commonjs/theta-repository/theta-files.js +33 -1
- package/lib/commonjs/theta-repository/theta-files.js.map +1 -1
- package/lib/commonjs/theta-repository/theta-info.js +29 -0
- package/lib/commonjs/theta-repository/theta-info.js.map +1 -1
- package/lib/commonjs/theta-repository/theta-repository.js +56 -8
- package/lib/commonjs/theta-repository/theta-repository.js.map +1 -1
- package/lib/commonjs/theta-repository/theta-timeout.js +2 -0
- package/lib/commonjs/theta-repository/theta-timeout.js.map +1 -0
- package/lib/module/capture/index.js +1 -0
- package/lib/module/capture/index.js.map +1 -1
- package/lib/module/capture/notify.js +6 -0
- package/lib/module/capture/notify.js.map +1 -0
- package/lib/module/capture/time-shift-capture.js +127 -0
- package/lib/module/capture/time-shift-capture.js.map +1 -0
- package/lib/module/theta-repository/access-point.js.map +1 -1
- package/lib/module/theta-repository/digest-auth.js +2 -0
- package/lib/module/theta-repository/digest-auth.js.map +1 -0
- package/lib/module/theta-repository/index.js +4 -1
- package/lib/module/theta-repository/index.js.map +1 -1
- package/lib/module/theta-repository/options/index.js +18 -0
- package/lib/module/theta-repository/options/index.js.map +1 -1
- package/lib/module/theta-repository/options/option-ai-auto-thumbnail.js +10 -0
- package/lib/module/theta-repository/options/option-ai-auto-thumbnail.js.map +1 -0
- package/lib/module/theta-repository/options/option-bitrate.js +57 -0
- package/lib/module/theta-repository/options/option-bitrate.js.map +1 -0
- package/lib/module/theta-repository/options/option-burst-mode.js +16 -0
- package/lib/module/theta-repository/options/option-burst-mode.js.map +1 -0
- package/lib/module/theta-repository/options/option-burst-option.js +133 -0
- package/lib/module/theta-repository/options/option-burst-option.js.map +1 -0
- package/lib/module/theta-repository/options/option-camera-control-source.js +22 -0
- package/lib/module/theta-repository/options/option-camera-control-source.js.map +1 -0
- package/lib/module/theta-repository/options/option-camera-mode.js +19 -0
- package/lib/module/theta-repository/options/option-camera-mode.js.map +1 -0
- package/lib/module/theta-repository/options/option-capture-mode.js +23 -0
- package/lib/module/theta-repository/options/option-capture-mode.js.map +1 -0
- package/lib/module/theta-repository/options/option-continuous-number.js +64 -0
- package/lib/module/theta-repository/options/option-continuous-number.js.map +1 -0
- package/lib/module/theta-repository/options/option-filter.js +25 -0
- package/lib/module/theta-repository/options/option-filter.js.map +1 -0
- package/lib/module/theta-repository/options/option-network-type.js +19 -0
- package/lib/module/theta-repository/options/option-network-type.js.map +1 -0
- package/lib/module/theta-repository/options/option-power-saving.js +17 -0
- package/lib/module/theta-repository/options/option-power-saving.js.map +1 -0
- package/lib/module/theta-repository/options/option-preset.js +19 -0
- package/lib/module/theta-repository/options/option-preset.js.map +1 -0
- package/lib/module/theta-repository/options/option-preview-format.js +25 -0
- package/lib/module/theta-repository/options/option-preview-format.js.map +1 -0
- package/lib/module/theta-repository/options/option-proxy.js +2 -0
- package/lib/module/theta-repository/options/option-proxy.js.map +1 -0
- package/lib/module/theta-repository/options/option-shooting-method.js +34 -0
- package/lib/module/theta-repository/options/option-shooting-method.js.map +1 -0
- package/lib/module/theta-repository/options/option-shutter-speed.js +295 -0
- package/lib/module/theta-repository/options/option-shutter-speed.js.map +1 -0
- package/lib/module/theta-repository/options/option-time-shift.js +36 -0
- package/lib/module/theta-repository/options/option-time-shift.js.map +1 -0
- package/lib/module/theta-repository/options/option-wlan-frequency.js +15 -0
- package/lib/module/theta-repository/options/option-wlan-frequency.js.map +1 -0
- package/lib/module/theta-repository/options/options.js +50 -24
- package/lib/module/theta-repository/options/options.js.map +1 -1
- package/lib/module/theta-repository/theta-config.js +2 -0
- package/lib/module/theta-repository/theta-config.js.map +1 -0
- package/lib/module/theta-repository/theta-files.js +32 -0
- package/lib/module/theta-repository/theta-files.js.map +1 -1
- package/lib/module/theta-repository/theta-info.js +22 -0
- package/lib/module/theta-repository/theta-info.js.map +1 -1
- package/lib/module/theta-repository/theta-repository.js +54 -9
- package/lib/module/theta-repository/theta-repository.js.map +1 -1
- package/lib/module/theta-repository/theta-timeout.js +2 -0
- package/lib/module/theta-repository/theta-timeout.js.map +1 -0
- package/lib/typescript/capture/capture.d.ts +1 -1
- package/lib/typescript/capture/capture.d.ts.map +1 -1
- package/lib/typescript/capture/index.d.ts +1 -0
- package/lib/typescript/capture/index.d.ts.map +1 -1
- package/lib/typescript/capture/notify.d.ts +13 -0
- package/lib/typescript/capture/notify.d.ts.map +1 -0
- package/lib/typescript/capture/time-shift-capture.d.ts +64 -0
- package/lib/typescript/capture/time-shift-capture.d.ts.map +1 -0
- package/lib/typescript/theta-repository/access-point.d.ts +4 -1
- package/lib/typescript/theta-repository/access-point.d.ts.map +1 -1
- package/lib/typescript/theta-repository/digest-auth.d.ts +17 -0
- package/lib/typescript/theta-repository/digest-auth.d.ts.map +1 -0
- package/lib/typescript/theta-repository/index.d.ts +4 -1
- package/lib/typescript/theta-repository/index.d.ts.map +1 -1
- package/lib/typescript/theta-repository/options/index.d.ts +18 -0
- package/lib/typescript/theta-repository/options/index.d.ts.map +1 -1
- package/lib/typescript/theta-repository/options/option-ai-auto-thumbnail.d.ts +10 -0
- package/lib/typescript/theta-repository/options/option-ai-auto-thumbnail.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-bitrate.d.ts +57 -0
- package/lib/typescript/theta-repository/options/option-bitrate.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-burst-mode.d.ts +16 -0
- package/lib/typescript/theta-repository/options/option-burst-mode.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-burst-option.d.ts +153 -0
- package/lib/typescript/theta-repository/options/option-burst-option.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-camera-control-source.d.ts +22 -0
- package/lib/typescript/theta-repository/options/option-camera-control-source.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-camera-mode.d.ts +19 -0
- package/lib/typescript/theta-repository/options/option-camera-mode.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-capture-mode.d.ts +23 -0
- package/lib/typescript/theta-repository/options/option-capture-mode.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-continuous-number.d.ts +64 -0
- package/lib/typescript/theta-repository/options/option-continuous-number.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-filter.d.ts +25 -0
- package/lib/typescript/theta-repository/options/option-filter.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-network-type.d.ts +19 -0
- package/lib/typescript/theta-repository/options/option-network-type.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-power-saving.d.ts +16 -0
- package/lib/typescript/theta-repository/options/option-power-saving.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-preset.d.ts +18 -0
- package/lib/typescript/theta-repository/options/option-preset.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-preview-format.d.ts +25 -0
- package/lib/typescript/theta-repository/options/option-preview-format.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-proxy.d.ts +23 -0
- package/lib/typescript/theta-repository/options/option-proxy.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-shooting-method.d.ts +33 -0
- package/lib/typescript/theta-repository/options/option-shooting-method.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-shutter-speed.d.ts +295 -0
- package/lib/typescript/theta-repository/options/option-shutter-speed.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-time-shift.d.ts +54 -0
- package/lib/typescript/theta-repository/options/option-time-shift.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/option-white-balance-auto-strength.d.ts +1 -1
- package/lib/typescript/theta-repository/options/option-white-balance-auto-strength.d.ts.map +1 -1
- package/lib/typescript/theta-repository/options/option-wlan-frequency.d.ts +15 -0
- package/lib/typescript/theta-repository/options/option-wlan-frequency.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/options.d.ts +187 -41
- package/lib/typescript/theta-repository/options/options.d.ts.map +1 -1
- package/lib/typescript/theta-repository/theta-config.d.ts +20 -0
- package/lib/typescript/theta-repository/theta-config.d.ts.map +1 -0
- package/lib/typescript/theta-repository/theta-files.d.ts +66 -3
- package/lib/typescript/theta-repository/theta-files.d.ts.map +1 -1
- package/lib/typescript/theta-repository/theta-info.d.ts +21 -0
- package/lib/typescript/theta-repository/theta-info.d.ts.map +1 -1
- package/lib/typescript/theta-repository/theta-repository.d.ts +36 -8
- package/lib/typescript/theta-repository/theta-repository.d.ts.map +1 -1
- package/lib/typescript/theta-repository/theta-state.d.ts +5 -5
- package/lib/typescript/theta-repository/theta-state.d.ts.map +1 -1
- package/lib/typescript/theta-repository/theta-timeout.d.ts +22 -0
- package/lib/typescript/theta-repository/theta-timeout.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/capture/capture.ts +1 -1
- package/src/capture/index.ts +1 -0
- package/src/capture/notify.ts +27 -0
- package/src/capture/time-shift-capture.ts +145 -0
- package/src/theta-repository/access-point.ts +5 -1
- package/src/theta-repository/digest-auth.ts +16 -0
- package/src/theta-repository/index.ts +4 -1
- package/src/theta-repository/options/index.ts +18 -0
- package/src/theta-repository/options/option-ai-auto-thumbnail.ts +11 -0
- package/src/theta-repository/options/option-bitrate.ts +59 -0
- package/src/theta-repository/options/option-burst-mode.ts +16 -0
- package/src/theta-repository/options/option-burst-option.ts +175 -0
- package/src/theta-repository/options/option-camera-control-source.ts +24 -0
- package/src/theta-repository/options/option-camera-mode.ts +20 -0
- package/src/theta-repository/options/option-capture-mode.ts +24 -0
- package/src/theta-repository/options/option-continuous-number.ts +65 -0
- package/src/theta-repository/options/option-filter.ts +25 -0
- package/src/theta-repository/options/option-network-type.ts +20 -0
- package/src/theta-repository/options/option-power-saving.ts +18 -0
- package/src/theta-repository/options/option-preset.ts +19 -0
- package/src/theta-repository/options/option-preview-format.ts +26 -0
- package/src/theta-repository/options/option-proxy.ts +22 -0
- package/src/theta-repository/options/option-shooting-method.ts +35 -0
- package/src/theta-repository/options/option-shutter-speed.ts +360 -0
- package/src/theta-repository/options/option-time-shift.ts +59 -0
- package/src/theta-repository/options/option-white-balance-auto-strength.ts +1 -1
- package/src/theta-repository/options/option-wlan-frequency.ts +16 -0
- package/src/theta-repository/options/options.ts +188 -46
- package/src/theta-repository/theta-config.ts +20 -0
- package/src/theta-repository/theta-files.ts +73 -3
- package/src/theta-repository/theta-info.ts +23 -0
- package/src/theta-repository/theta-repository.ts +87 -18
- package/src/theta-repository/theta-state.ts +5 -5
- package/src/theta-repository/theta-timeout.ts +21 -0
- package/theta-client-react-native.podspec +1 -1
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
#import "ThetaClientReactNative.h"
|
|
3
3
|
#import "RCTConvert.h"
|
|
4
4
|
|
|
5
|
+
#define MESSAGE_NOT_INIT @"Not initialized."
|
|
6
|
+
#define ERROR_CODE_ERROR @"error"
|
|
7
|
+
|
|
8
|
+
static NSDictionary* toNotify(NSString *name, NSDictionary *params) {
|
|
9
|
+
NSMutableDictionary *objects = [NSMutableDictionary dictionary];
|
|
10
|
+
[objects setObject:name forKey:@"name"];
|
|
11
|
+
if (params != nil) {
|
|
12
|
+
[objects setObject:params forKey:@"params"];
|
|
13
|
+
}
|
|
14
|
+
return objects;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static NSDictionary* toCaptureProgressNotifyParam(NSNumber *value) {
|
|
18
|
+
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
|
19
|
+
[result setObject:value forKey:@"completion"];
|
|
20
|
+
return toNotify(@"TIME-SHIFT-PROGRESS", result);
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
/**
|
|
6
24
|
* converter for int32_t
|
|
7
25
|
*/
|
|
@@ -45,7 +63,7 @@ RCT_NUMBER_CONVERTER(int32_t, intValue)
|
|
|
45
63
|
*/
|
|
46
64
|
-(void)onErrorException:(THETACThetaRepositoryThetaRepositoryException *)exception
|
|
47
65
|
{
|
|
48
|
-
_reject(
|
|
66
|
+
_reject(ERROR_CODE_ERROR, exception.message, nil);
|
|
49
67
|
_sdk.photoCapture = nil;
|
|
50
68
|
}
|
|
51
69
|
|
|
@@ -58,6 +76,74 @@ RCT_NUMBER_CONVERTER(int32_t, intValue)
|
|
|
58
76
|
_resolve(fileUrl);
|
|
59
77
|
_sdk.photoCapture = nil;
|
|
60
78
|
}
|
|
79
|
+
|
|
80
|
+
- (void)onProgressCompletion:(float)completion {
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@end
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* time-shift startCapture callback holder
|
|
87
|
+
*/
|
|
88
|
+
typedef void (^ TimeShiftOnProgressBlock)(float);
|
|
89
|
+
@interface TimeShiftStartCallback: NSObject <THETACTimeShiftCaptureStartCaptureCallback>
|
|
90
|
+
@end
|
|
91
|
+
@implementation TimeShiftStartCallback {
|
|
92
|
+
RCTPromiseResolveBlock _resolve; ///< start capture resolver
|
|
93
|
+
TimeShiftOnProgressBlock _onProgress; ///< start capture resolver
|
|
94
|
+
RCTPromiseRejectBlock _reject; ///< start capture rejecter
|
|
95
|
+
ThetaClientReactNative *_sdk; ///< theta client sdk instance
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* initialize TimeShiftCallback
|
|
100
|
+
* @param sdk theta client sdk instance
|
|
101
|
+
* @param resolve resolver for promise
|
|
102
|
+
* @param reject rejecter for promise
|
|
103
|
+
* @return initialized callback instance
|
|
104
|
+
*/
|
|
105
|
+
-(id)initWith:(ThetaClientReactNative *)sdk
|
|
106
|
+
withProgress:(TimeShiftOnProgressBlock)onProgress
|
|
107
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
108
|
+
withRejecter:(RCTPromiseRejectBlock)reject
|
|
109
|
+
{
|
|
110
|
+
self = [super init];
|
|
111
|
+
if (self) {
|
|
112
|
+
_sdk = sdk;
|
|
113
|
+
_onProgress = onProgress;
|
|
114
|
+
_resolve = resolve;
|
|
115
|
+
_reject = reject;
|
|
116
|
+
}
|
|
117
|
+
return self;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* call when error detect
|
|
122
|
+
* @param exception exception object
|
|
123
|
+
*/
|
|
124
|
+
-(void)onErrorException:(THETACThetaRepositoryThetaRepositoryException *)exception {
|
|
125
|
+
_reject(@"error", exception.message, nil);
|
|
126
|
+
_sdk.timeShiftCapture = nil;
|
|
127
|
+
_sdk.timeShiftCapturing = nil;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* call when successfully time-shift captured
|
|
132
|
+
* @param fileUrl captured video file url
|
|
133
|
+
*/
|
|
134
|
+
- (void)onSuccessFileUrl_:(NSString * _Nullable)fileUrl {
|
|
135
|
+
_resolve(fileUrl != nil ? fileUrl : [NSNull null]);
|
|
136
|
+
_sdk.timeShiftCapture = nil;
|
|
137
|
+
_sdk.timeShiftCapturing = nil;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* call when check time-shift progress
|
|
142
|
+
* @param completion captured video file url
|
|
143
|
+
*/
|
|
144
|
+
- (void)onProgressCompletion:(float)completion {
|
|
145
|
+
_onProgress(completion);
|
|
146
|
+
}
|
|
61
147
|
@end
|
|
62
148
|
|
|
63
149
|
/**
|
|
@@ -97,7 +183,7 @@ RCT_NUMBER_CONVERTER(int32_t, intValue)
|
|
|
97
183
|
*/
|
|
98
184
|
-(void)onErrorException:(THETACThetaRepositoryThetaRepositoryException *)exception
|
|
99
185
|
{
|
|
100
|
-
_reject(
|
|
186
|
+
_reject(ERROR_CODE_ERROR, exception.message, nil);
|
|
101
187
|
_sdk.videoCapture = nil;
|
|
102
188
|
_sdk.videoCapturing = nil;
|
|
103
189
|
}
|
|
@@ -166,26 +252,251 @@ static CFTimeInterval FRAME_INTERVAL = (CFTimeInterval) (1.0/10.0);
|
|
|
166
252
|
}
|
|
167
253
|
@end
|
|
168
254
|
|
|
255
|
+
/**
|
|
256
|
+
* check null for object
|
|
257
|
+
*/
|
|
258
|
+
static bool isNull(id obj) {
|
|
259
|
+
return (obj == nil || obj == [NSNull null]);
|
|
260
|
+
}
|
|
261
|
+
|
|
169
262
|
/** opiton converter from theta to react */
|
|
170
263
|
typedef void (^SetFromTheta)(NSMutableDictionary *, THETACThetaRepositoryOptions *);
|
|
171
264
|
/** option converter from react to theta */
|
|
172
265
|
typedef void (^SetToTheta)(NSDictionary *, THETACThetaRepositoryOptions *);
|
|
173
266
|
/** option converter to set photo option */
|
|
174
267
|
typedef void (^SetPhotoOption)(NSDictionary *, THETACPhotoCaptureBuilder *);
|
|
268
|
+
/** option converter to set time-shift option */
|
|
269
|
+
typedef void (^SetTimeShiftOption)(NSDictionary *, THETACTimeShiftCaptureBuilder *);
|
|
175
270
|
/** option converter to set video option */
|
|
176
271
|
typedef void (^SetVideoOption)(NSDictionary *, THETACVideoCaptureBuilder *);
|
|
177
272
|
|
|
178
273
|
typedef struct _convert_t {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
274
|
+
NSDictionary* toTheta; ///< dictionary react to theta
|
|
275
|
+
NSDictionary* fromTheta; ///< dictionary theta to react
|
|
276
|
+
NSDictionary* photoOption; ///< dictionary photoOption
|
|
277
|
+
NSDictionary* videoOption; ///< dictionary videoOption
|
|
278
|
+
SetToTheta setToTheta; ///< option setter react to theta
|
|
279
|
+
SetFromTheta setFromTheta; ///< option setter theta to react
|
|
280
|
+
SetPhotoOption setPhotoOption; ///< photo option setter
|
|
281
|
+
SetTimeShiftOption setTimeShiftOption; ///< time-shift option setter
|
|
282
|
+
SetVideoOption setVideoOption; ///< video option setter
|
|
187
283
|
} convert_t;
|
|
188
284
|
|
|
285
|
+
/**
|
|
286
|
+
* BitrateEnum converter
|
|
287
|
+
*/
|
|
288
|
+
static convert_t BitrateEnum = {
|
|
289
|
+
.toTheta = nil,
|
|
290
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
291
|
+
if (!BitrateEnum.toTheta) {
|
|
292
|
+
NSMutableDictionary* dictionary = [NSMutableDictionary dictionary];
|
|
293
|
+
THETACKotlinArray* array = THETACThetaRepositoryBitrateEnum.values;
|
|
294
|
+
for (int i = 0; i < array.size; i++) {
|
|
295
|
+
THETACThetaRepositoryBitrateEnum* item = [array getIndex:i];
|
|
296
|
+
[dictionary setObject:item forKey:item.name];
|
|
297
|
+
}
|
|
298
|
+
BitrateEnum.toTheta = dictionary;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
id rv = [rct objectForKey:@"bitrate"];
|
|
302
|
+
if (rv) {
|
|
303
|
+
if ([rv isKindOfClass:NSString.class]) {
|
|
304
|
+
opt.bitrate = [BitrateEnum.toTheta objectForKey:rv];
|
|
305
|
+
} else if ([rv isKindOfClass:NSNumber.class]) {
|
|
306
|
+
id val = [[THETACThetaRepositoryBitrateNumber alloc] initWithValue:[rv intValue]];
|
|
307
|
+
opt.bitrate = val;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
312
|
+
if ([((id)opt.bitrate) isKindOfClass:THETACThetaRepositoryBitrateEnum.class]) {
|
|
313
|
+
THETACThetaRepositoryBitrateEnum* bitrateEnum = (THETACThetaRepositoryBitrateEnum*)opt.bitrate;
|
|
314
|
+
[rct setObject:bitrateEnum.name forKey:@"bitrate"];
|
|
315
|
+
} else if ([((id)opt.bitrate) isKindOfClass:THETACThetaRepositoryBitrateNumber.class]) {
|
|
316
|
+
THETACThetaRepositoryBitrateNumber* bitrateNumber = (THETACThetaRepositoryBitrateNumber*)opt.bitrate;
|
|
317
|
+
[rct setObject:[NSNumber numberWithInt:bitrateNumber.value] forKey:@"bitrate"];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* BurstModeEnum converter
|
|
324
|
+
*/
|
|
325
|
+
static convert_t BurstModeEnum = {
|
|
326
|
+
.toTheta = @{
|
|
327
|
+
@"ON": THETACThetaRepositoryBurstModeEnum.on,
|
|
328
|
+
@"OFF": THETACThetaRepositoryBurstModeEnum.off
|
|
329
|
+
},
|
|
330
|
+
.fromTheta = @{
|
|
331
|
+
THETACThetaRepositoryBurstModeEnum.on: @"ON",
|
|
332
|
+
THETACThetaRepositoryBurstModeEnum.off: @"OFF"
|
|
333
|
+
},
|
|
334
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
335
|
+
id val = [BurstModeEnum.toTheta objectForKey:[rct objectForKey:@"burstMode"]];
|
|
336
|
+
if (val) {
|
|
337
|
+
opt.burstMode = val;
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
341
|
+
id val = [BurstModeEnum.fromTheta objectForKey:opt.burstMode];
|
|
342
|
+
if (val) {
|
|
343
|
+
[rct setObject:val forKey:@"burstMode"];
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
static convert_t BurstCaptureNumEnum = {
|
|
349
|
+
.toTheta = @{
|
|
350
|
+
@"BURST_CAPTURE_NUM_1": THETACThetaRepositoryBurstCaptureNumEnum.burstCaptureNum1,
|
|
351
|
+
@"BURST_CAPTURE_NUM_3": THETACThetaRepositoryBurstCaptureNumEnum.burstCaptureNum3,
|
|
352
|
+
@"BURST_CAPTURE_NUM_5": THETACThetaRepositoryBurstCaptureNumEnum.burstCaptureNum5,
|
|
353
|
+
@"BURST_CAPTURE_NUM_7": THETACThetaRepositoryBurstCaptureNumEnum.burstCaptureNum7,
|
|
354
|
+
@"BURST_CAPTURE_NUM_9": THETACThetaRepositoryBurstCaptureNumEnum.burstCaptureNum9
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
static convert_t BurstBracketStepEnum = {
|
|
359
|
+
.toTheta = @{
|
|
360
|
+
@"BRACKET_STEP_0_0": THETACThetaRepositoryBurstBracketStepEnum.bracketStep00,
|
|
361
|
+
@"BRACKET_STEP_0_3": THETACThetaRepositoryBurstBracketStepEnum.bracketStep03,
|
|
362
|
+
@"BRACKET_STEP_0_7": THETACThetaRepositoryBurstBracketStepEnum.bracketStep07,
|
|
363
|
+
@"BRACKET_STEP_1_0": THETACThetaRepositoryBurstBracketStepEnum.bracketStep10,
|
|
364
|
+
@"BRACKET_STEP_1_3": THETACThetaRepositoryBurstBracketStepEnum.bracketStep13,
|
|
365
|
+
@"BRACKET_STEP_1_7": THETACThetaRepositoryBurstBracketStepEnum.bracketStep17,
|
|
366
|
+
@"BRACKET_STEP_2_0": THETACThetaRepositoryBurstBracketStepEnum.bracketStep20,
|
|
367
|
+
@"BRACKET_STEP_2_3": THETACThetaRepositoryBurstBracketStepEnum.bracketStep23,
|
|
368
|
+
@"BRACKET_STEP_2_7": THETACThetaRepositoryBurstBracketStepEnum.bracketStep27,
|
|
369
|
+
@"BRACKET_STEP_3_0": THETACThetaRepositoryBurstBracketStepEnum.bracketStep30
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
static convert_t BurstCompensationEnum = {
|
|
374
|
+
.toTheta = @{
|
|
375
|
+
@"BURST_COMPENSATION_DOWN_5_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown50,
|
|
376
|
+
@"BURST_COMPENSATION_DOWN_4_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown47,
|
|
377
|
+
@"BURST_COMPENSATION_DOWN_4_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown43,
|
|
378
|
+
@"BURST_COMPENSATION_DOWN_4_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown40,
|
|
379
|
+
@"BURST_COMPENSATION_DOWN_3_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown37,
|
|
380
|
+
@"BURST_COMPENSATION_DOWN_3_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown33,
|
|
381
|
+
@"BURST_COMPENSATION_DOWN_3_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown30,
|
|
382
|
+
@"BURST_COMPENSATION_DOWN_2_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown27,
|
|
383
|
+
@"BURST_COMPENSATION_DOWN_2_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown23,
|
|
384
|
+
@"BURST_COMPENSATION_DOWN_2_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown20,
|
|
385
|
+
@"BURST_COMPENSATION_DOWN_1_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown17,
|
|
386
|
+
@"BURST_COMPENSATION_DOWN_1_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown13,
|
|
387
|
+
@"BURST_COMPENSATION_DOWN_1_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown10,
|
|
388
|
+
@"BURST_COMPENSATION_DOWN_0_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown07,
|
|
389
|
+
@"BURST_COMPENSATION_DOWN_0_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationDown03,
|
|
390
|
+
@"BURST_COMPENSATION_0_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensation00,
|
|
391
|
+
@"BURST_COMPENSATION_UP_0_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp03,
|
|
392
|
+
@"BURST_COMPENSATION_UP_0_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp07,
|
|
393
|
+
@"BURST_COMPENSATION_UP_1_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp10,
|
|
394
|
+
@"BURST_COMPENSATION_UP_1_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp13,
|
|
395
|
+
@"BURST_COMPENSATION_UP_1_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp17,
|
|
396
|
+
@"BURST_COMPENSATION_UP_2_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp20,
|
|
397
|
+
@"BURST_COMPENSATION_UP_2_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp23,
|
|
398
|
+
@"BURST_COMPENSATION_UP_2_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp27,
|
|
399
|
+
@"BURST_COMPENSATION_UP_3_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp30,
|
|
400
|
+
@"BURST_COMPENSATION_UP_3_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp33,
|
|
401
|
+
@"BURST_COMPENSATION_UP_3_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp37,
|
|
402
|
+
@"BURST_COMPENSATION_UP_4_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp40,
|
|
403
|
+
@"BURST_COMPENSATION_UP_4_3": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp43,
|
|
404
|
+
@"BURST_COMPENSATION_UP_4_7": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp47,
|
|
405
|
+
@"BURST_COMPENSATION_UP_5_0": THETACThetaRepositoryBurstCompensationEnum.burstCompensationUp50
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
static convert_t BurstMaxExposureTimeEnum = {
|
|
410
|
+
.toTheta = @{
|
|
411
|
+
@"MAX_EXPOSURE_TIME_0_5": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime05,
|
|
412
|
+
@"MAX_EXPOSURE_TIME_0_625": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime0625,
|
|
413
|
+
@"MAX_EXPOSURE_TIME_0_76923076": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime076923076,
|
|
414
|
+
@"MAX_EXPOSURE_TIME_1": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime1,
|
|
415
|
+
@"MAX_EXPOSURE_TIME_1_3": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime13,
|
|
416
|
+
@"MAX_EXPOSURE_TIME_1_6": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime16,
|
|
417
|
+
@"MAX_EXPOSURE_TIME_2": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime2,
|
|
418
|
+
@"MAX_EXPOSURE_TIME_2_5": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime25,
|
|
419
|
+
@"MAX_EXPOSURE_TIME_3_2": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime32,
|
|
420
|
+
@"MAX_EXPOSURE_TIME_4": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime4,
|
|
421
|
+
@"MAX_EXPOSURE_TIME_5": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime5,
|
|
422
|
+
@"MAX_EXPOSURE_TIME_6": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime6,
|
|
423
|
+
@"MAX_EXPOSURE_TIME_8": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime8,
|
|
424
|
+
@"MAX_EXPOSURE_TIME_10": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime10,
|
|
425
|
+
@"MAX_EXPOSURE_TIME_13": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime13_,
|
|
426
|
+
@"MAX_EXPOSURE_TIME_15": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime15,
|
|
427
|
+
@"MAX_EXPOSURE_TIME_20": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime20,
|
|
428
|
+
@"MAX_EXPOSURE_TIME_25": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime25_,
|
|
429
|
+
@"MAX_EXPOSURE_TIME_30": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime30,
|
|
430
|
+
@"MAX_EXPOSURE_TIME_40": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime40,
|
|
431
|
+
@"MAX_EXPOSURE_TIME_50": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime50,
|
|
432
|
+
@"MAX_EXPOSURE_TIME_60": THETACThetaRepositoryBurstMaxExposureTimeEnum.maxExposureTime60
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
static convert_t BurstEnableIsoControlEnum = {
|
|
437
|
+
.toTheta = @{
|
|
438
|
+
@"OFF": THETACThetaRepositoryBurstEnableIsoControlEnum.off,
|
|
439
|
+
@"ON": THETACThetaRepositoryBurstEnableIsoControlEnum.on
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
static convert_t BurstOrderEnum = {
|
|
444
|
+
.toTheta = @{
|
|
445
|
+
@"BURST_BRACKET_ORDER_0": THETACThetaRepositoryBurstOrderEnum.burstBracketOrder0,
|
|
446
|
+
@"BURST_BRACKET_ORDER_1": THETACThetaRepositoryBurstOrderEnum.burstBracketOrder1
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* BurstOption converter
|
|
452
|
+
*/
|
|
453
|
+
static convert_t BurstOptionCvt = {
|
|
454
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
455
|
+
NSDictionary *dic = [rct objectForKey:@"burstOption"];
|
|
456
|
+
if (dic) {
|
|
457
|
+
opt.burstOption = [[THETACThetaRepositoryBurstOption alloc]
|
|
458
|
+
initWithBurstCaptureNum:!isNull([dic objectForKey:@"burstCaptureNum"]) ? [BurstCaptureNumEnum.toTheta objectForKey:[dic objectForKey:@"burstCaptureNum"]] : nil
|
|
459
|
+
burstBracketStep:!isNull([dic objectForKey:@"burstBracketStep"]) ? [BurstBracketStepEnum.toTheta objectForKey:[dic objectForKey:@"burstBracketStep"]] : nil
|
|
460
|
+
burstCompensation:!isNull([dic objectForKey:@"burstCompensation"]) ? [BurstCompensationEnum.toTheta objectForKey:[dic objectForKey:@"burstCompensation"]] : nil
|
|
461
|
+
burstMaxExposureTime:!isNull([dic objectForKey:@"burstMaxExposureTime"]) ? [BurstMaxExposureTimeEnum.toTheta objectForKey:[dic objectForKey:@"burstMaxExposureTime"]] : nil
|
|
462
|
+
burstEnableIsoControl:!isNull([dic objectForKey:@"burstEnableIsoControl"]) ? [BurstEnableIsoControlEnum.toTheta objectForKey:[dic objectForKey:@"burstEnableIsoControl"]] : nil
|
|
463
|
+
burstOrder:!isNull([dic objectForKey:@"burstOrder"]) ? [BurstOrderEnum.toTheta objectForKey:[dic objectForKey:@"burstOrder"]] : nil];
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
|
|
467
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
468
|
+
if (opt.burstOption) {
|
|
469
|
+
NSMutableDictionary *burstOption = [NSMutableDictionary dictionary];
|
|
470
|
+
|
|
471
|
+
if (opt.burstOption.burstCaptureNum) {
|
|
472
|
+
[burstOption setObject:opt.burstOption.burstCaptureNum.name forKey:@"burstCaptureNum"];
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
if (opt.burstOption.burstBracketStep) {
|
|
476
|
+
[burstOption setObject:opt.burstOption.burstBracketStep.name forKey:@"burstBracketStep"];
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (opt.burstOption.burstCompensation) {
|
|
480
|
+
[burstOption setObject:opt.burstOption.burstCompensation.name forKey:@"burstCompensation"];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (opt.burstOption.burstMaxExposureTime) {
|
|
484
|
+
[burstOption setObject:opt.burstOption.burstMaxExposureTime.name forKey:@"burstMaxExposureTime"];
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if (opt.burstOption.burstEnableIsoControl) {
|
|
488
|
+
[burstOption setObject:opt.burstOption.burstEnableIsoControl.name forKey:@"burstEnableIsoControl"];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (opt.burstOption.burstOrder) {
|
|
492
|
+
[burstOption setObject:opt.burstOption.burstOrder.name forKey:@"burstOrder"];
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
[rct setObject:burstOption forKey:@"burstOption"];
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
|
|
189
500
|
/**
|
|
190
501
|
* ChargingStateEnum converter
|
|
191
502
|
*/
|
|
@@ -264,6 +575,17 @@ static convert_t FileTypeEnum = {
|
|
|
264
575
|
}
|
|
265
576
|
};
|
|
266
577
|
|
|
578
|
+
/**
|
|
579
|
+
* StorageEnum converter
|
|
580
|
+
*/
|
|
581
|
+
static convert_t StorageEnum = {
|
|
582
|
+
.toTheta = @{
|
|
583
|
+
@"INTERNAL": THETACThetaRepositoryStorageEnum.internal,
|
|
584
|
+
@"SD": THETACThetaRepositoryStorageEnum.sd,
|
|
585
|
+
@"CURRENT": THETACThetaRepositoryStorageEnum.current,
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
|
|
267
589
|
/**
|
|
268
590
|
* AuthModeEnum converter
|
|
269
591
|
*/
|
|
@@ -280,6 +602,32 @@ static convert_t AuthModeEnum = {
|
|
|
280
602
|
}
|
|
281
603
|
};
|
|
282
604
|
|
|
605
|
+
/**
|
|
606
|
+
* AiAutoThumbnailEnum converter
|
|
607
|
+
*/
|
|
608
|
+
static convert_t AiAutoThumbnailEnum = {
|
|
609
|
+
.toTheta = @{
|
|
610
|
+
@"ON": THETACThetaRepositoryAiAutoThumbnailEnum.on,
|
|
611
|
+
@"OFF": THETACThetaRepositoryAiAutoThumbnailEnum.off
|
|
612
|
+
},
|
|
613
|
+
.fromTheta = @{
|
|
614
|
+
THETACThetaRepositoryAiAutoThumbnailEnum.on: @"ON",
|
|
615
|
+
THETACThetaRepositoryAiAutoThumbnailEnum.off: @"OFF"
|
|
616
|
+
},
|
|
617
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
618
|
+
id val = [AiAutoThumbnailEnum.toTheta objectForKey:[rct objectForKey:@"aiAutoThumbnail"]];
|
|
619
|
+
if (val) {
|
|
620
|
+
opt.aiAutoThumbnail = val;
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
624
|
+
id val = [AiAutoThumbnailEnum.fromTheta objectForKey:opt.aiAutoThumbnail];
|
|
625
|
+
if (val) {
|
|
626
|
+
[rct setObject:val forKey:@"aiAutoThumbnail"];
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
|
|
283
631
|
/**
|
|
284
632
|
* ApertureEnum converter
|
|
285
633
|
*/
|
|
@@ -318,6 +666,12 @@ static convert_t ApertureEnum = {
|
|
|
318
666
|
[builder setApertureAperture:val];
|
|
319
667
|
}
|
|
320
668
|
},
|
|
669
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
670
|
+
id val = [ApertureEnum.toTheta objectForKey:[rct objectForKey:@"aperture"]];
|
|
671
|
+
if (val) {
|
|
672
|
+
[builder setApertureAperture:val];
|
|
673
|
+
}
|
|
674
|
+
},
|
|
321
675
|
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
322
676
|
id val = [ApertureEnum.toTheta objectForKey:[rct objectForKey:@"aperture"]];
|
|
323
677
|
if (val) {
|
|
@@ -352,17 +706,96 @@ static convert_t BluetoothPowerEnum = {
|
|
|
352
706
|
}
|
|
353
707
|
};
|
|
354
708
|
|
|
709
|
+
/**
|
|
710
|
+
* CameraControlSourceEnum converter
|
|
711
|
+
*/
|
|
712
|
+
static convert_t CameraControlSourceEnum = {
|
|
713
|
+
.toTheta = @{
|
|
714
|
+
@"CAMERA": THETACThetaRepositoryCameraControlSourceEnum.camera,
|
|
715
|
+
@"APP": THETACThetaRepositoryCameraControlSourceEnum.app
|
|
716
|
+
},
|
|
717
|
+
.fromTheta = @{
|
|
718
|
+
THETACThetaRepositoryCameraControlSourceEnum.camera: @"CAMERA",
|
|
719
|
+
THETACThetaRepositoryCameraControlSourceEnum.app: @"APP"
|
|
720
|
+
},
|
|
721
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
722
|
+
id val = [CameraControlSourceEnum.toTheta objectForKey:[rct objectForKey:@"cameraControlSource"]];
|
|
723
|
+
if (val) {
|
|
724
|
+
opt.cameraControlSource = val;
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
728
|
+
id val = [CameraControlSourceEnum.fromTheta objectForKey:opt.cameraControlSource];
|
|
729
|
+
if (val) {
|
|
730
|
+
[rct setObject:val forKey:@"cameraControlSource"];
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* CameraModeEnum converter
|
|
737
|
+
*/
|
|
738
|
+
static convert_t CameraModeEnum = {
|
|
739
|
+
.toTheta = @{
|
|
740
|
+
@"CAPTURE": THETACThetaRepositoryCameraModeEnum.capture,
|
|
741
|
+
@"PLAYBACK": THETACThetaRepositoryCameraModeEnum.playback,
|
|
742
|
+
@"SETTING": THETACThetaRepositoryCameraModeEnum.setting,
|
|
743
|
+
@"PLUGIN": THETACThetaRepositoryCameraModeEnum.plugin
|
|
744
|
+
},
|
|
745
|
+
.fromTheta = @{
|
|
746
|
+
THETACThetaRepositoryCameraModeEnum.capture: @"CAPTURE",
|
|
747
|
+
THETACThetaRepositoryCameraModeEnum.playback: @"PLAYBACK",
|
|
748
|
+
THETACThetaRepositoryCameraModeEnum.setting: @"SETTING",
|
|
749
|
+
THETACThetaRepositoryCameraModeEnum.plugin: @"PLUGIN"
|
|
750
|
+
},
|
|
751
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
752
|
+
id val = [CameraModeEnum.toTheta objectForKey:[rct objectForKey:@"cameraMode"]];
|
|
753
|
+
if (val) {
|
|
754
|
+
opt.cameraMode = val;
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
758
|
+
id val = [CameraModeEnum.fromTheta objectForKey:opt.cameraMode];
|
|
759
|
+
if (val) {
|
|
760
|
+
[rct setObject:val forKey:@"cameraMode"];
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* CaptureInterval converter
|
|
767
|
+
*/
|
|
768
|
+
static convert_t CaptureIntervalConverter = {
|
|
769
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
770
|
+
NSNumber* val = [rct objectForKey:@"captureInterval"];
|
|
771
|
+
if (val) {
|
|
772
|
+
opt.captureInterval = [THETACInt numberWithInt:[val intValue]];
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
776
|
+
if (opt.captureInterval) {
|
|
777
|
+
[rct setObject:opt.captureInterval forKey:@"captureInterval"];
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
};
|
|
781
|
+
|
|
355
782
|
/**
|
|
356
783
|
* CaptureModeEnum converter
|
|
357
784
|
*/
|
|
358
785
|
static convert_t CaptureModeEnum = {
|
|
359
786
|
.toTheta = @{
|
|
360
787
|
@"IMAGE": THETACThetaRepositoryCaptureModeEnum.image,
|
|
361
|
-
@"VIDEO": THETACThetaRepositoryCaptureModeEnum.video
|
|
788
|
+
@"VIDEO": THETACThetaRepositoryCaptureModeEnum.video,
|
|
789
|
+
@"LIVE_STREAMING": THETACThetaRepositoryCaptureModeEnum.liveStreaming,
|
|
790
|
+
@"INTERVAL": THETACThetaRepositoryCaptureModeEnum.interval,
|
|
791
|
+
@"PRESET": THETACThetaRepositoryCaptureModeEnum.preset
|
|
362
792
|
},
|
|
363
793
|
.fromTheta = @{
|
|
364
794
|
THETACThetaRepositoryCaptureModeEnum.image: @"IMAGE",
|
|
365
|
-
THETACThetaRepositoryCaptureModeEnum.video: @"VIDEO"
|
|
795
|
+
THETACThetaRepositoryCaptureModeEnum.video: @"VIDEO",
|
|
796
|
+
THETACThetaRepositoryCaptureModeEnum.liveStreaming: @"LIVE_STREAMING",
|
|
797
|
+
THETACThetaRepositoryCaptureModeEnum.interval: @"INTERVAL",
|
|
798
|
+
THETACThetaRepositoryCaptureModeEnum.preset: @"PRESET"
|
|
366
799
|
},
|
|
367
800
|
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
368
801
|
id val = [CaptureModeEnum.toTheta objectForKey:[rct objectForKey:@"captureMode"]];
|
|
@@ -378,6 +811,61 @@ static convert_t CaptureModeEnum = {
|
|
|
378
811
|
}
|
|
379
812
|
};
|
|
380
813
|
|
|
814
|
+
/**
|
|
815
|
+
* CaptureNumber converter
|
|
816
|
+
*/
|
|
817
|
+
static convert_t CaptureNumberConverter = {
|
|
818
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
819
|
+
NSNumber* val = [rct objectForKey:@"captureNumber"];
|
|
820
|
+
if (val) {
|
|
821
|
+
opt.captureNumber = [THETACInt numberWithInt:[val intValue]];
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
825
|
+
if (opt.captureNumber) {
|
|
826
|
+
[rct setObject:opt.captureNumber forKey:@"captureNumber"];
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* ContinuousNumberEnum converter
|
|
833
|
+
*/
|
|
834
|
+
static convert_t ContinuousNumberEnum = {
|
|
835
|
+
.toTheta = nil,
|
|
836
|
+
.fromTheta = nil,
|
|
837
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
838
|
+
if (!ContinuousNumberEnum.toTheta) {
|
|
839
|
+
NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
|
|
840
|
+
THETACKotlinArray* array = THETACThetaRepositoryContinuousNumberEnum.values;
|
|
841
|
+
for (int i = 0; i < array.size; i++) {
|
|
842
|
+
THETACThetaRepositoryContinuousNumberEnum* item = [array getIndex:i];
|
|
843
|
+
[dictionary setObject:item forKey:item.name];
|
|
844
|
+
}
|
|
845
|
+
ContinuousNumberEnum.toTheta = dictionary;
|
|
846
|
+
}
|
|
847
|
+
id val = [ContinuousNumberEnum.toTheta objectForKey:[rct objectForKey:@"continuousNumber"]];
|
|
848
|
+
if (val) {
|
|
849
|
+
opt.continuousNumber = val;
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
853
|
+
if (!ContinuousNumberEnum.fromTheta) {
|
|
854
|
+
NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
|
|
855
|
+
THETACKotlinArray* array = THETACThetaRepositoryContinuousNumberEnum.values;
|
|
856
|
+
for (int i = 0; i < array.size; i++) {
|
|
857
|
+
THETACThetaRepositoryContinuousNumberEnum* item = [array getIndex:i];
|
|
858
|
+
[dictionary setObject:item.name forKey:item];
|
|
859
|
+
}
|
|
860
|
+
ContinuousNumberEnum.fromTheta = dictionary;
|
|
861
|
+
}
|
|
862
|
+
id val = [ContinuousNumberEnum.fromTheta objectForKey:opt.continuousNumber];
|
|
863
|
+
if (val) {
|
|
864
|
+
[rct setObject:val forKey:@"continuousNumber"];
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
|
|
381
869
|
/**
|
|
382
870
|
* ExposureCompensationEnum converter
|
|
383
871
|
*/
|
|
@@ -432,6 +920,12 @@ static convert_t ExposureCompensationEnum = {
|
|
|
432
920
|
[builder setExposureCompensationValue:val];
|
|
433
921
|
}
|
|
434
922
|
},
|
|
923
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
924
|
+
id val = [ExposureCompensationEnum.toTheta objectForKey:[rct objectForKey:@"exposureCompensation"]];
|
|
925
|
+
if (val) {
|
|
926
|
+
[builder setExposureCompensationValue:val];
|
|
927
|
+
}
|
|
928
|
+
},
|
|
435
929
|
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
436
930
|
id val = [ExposureCompensationEnum.toTheta
|
|
437
931
|
objectForKey:[rct objectForKey:@"exposureCompensation"]];
|
|
@@ -489,6 +983,12 @@ static convert_t ExposureDelayEnum = {
|
|
|
489
983
|
[builder setExposureDelayDelay:val];
|
|
490
984
|
}
|
|
491
985
|
},
|
|
986
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
987
|
+
id val = [ExposureDelayEnum.toTheta objectForKey:[rct objectForKey:@"exposureDelay"]];
|
|
988
|
+
if (val) {
|
|
989
|
+
[builder setExposureDelayDelay:val];
|
|
990
|
+
}
|
|
991
|
+
},
|
|
492
992
|
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
493
993
|
id val = [ExposureDelayEnum.toTheta objectForKey:[rct objectForKey:@"exposureDelay"]];
|
|
494
994
|
if (val) {
|
|
@@ -535,6 +1035,12 @@ static convert_t ExposureProgramEnum = {
|
|
|
535
1035
|
[builder setExposureProgramProgram:val];
|
|
536
1036
|
}
|
|
537
1037
|
},
|
|
1038
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
1039
|
+
id val = [ExposureProgramEnum.toTheta objectForKey:[rct objectForKey:@"exposureProgram"]];
|
|
1040
|
+
if (val) {
|
|
1041
|
+
[builder setExposureProgramProgram:val];
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
538
1044
|
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
539
1045
|
id val = [ExposureProgramEnum.toTheta
|
|
540
1046
|
objectForKey:[rct objectForKey:@"exposureProgram"]];
|
|
@@ -664,13 +1170,17 @@ static convert_t FileFormatEnum = {
|
|
|
664
1170
|
static convert_t FilterEnum = {
|
|
665
1171
|
.toTheta = @{
|
|
666
1172
|
@"OFF": THETACThetaRepositoryFilterEnum.off,
|
|
1173
|
+
@"DR_COMP": THETACThetaRepositoryFilterEnum.drComp,
|
|
667
1174
|
@"NOISE_REDUCTION": THETACThetaRepositoryFilterEnum.noiseReduction,
|
|
668
|
-
@"HDR": THETACThetaRepositoryFilterEnum.hdr
|
|
1175
|
+
@"HDR": THETACThetaRepositoryFilterEnum.hdr,
|
|
1176
|
+
@"HH_HDR": THETACThetaRepositoryFilterEnum.hhHdr
|
|
669
1177
|
},
|
|
670
1178
|
.fromTheta = @{
|
|
671
1179
|
THETACThetaRepositoryFilterEnum.off: @"OFF",
|
|
1180
|
+
THETACThetaRepositoryFilterEnum.drComp: @"DR_COMP",
|
|
672
1181
|
THETACThetaRepositoryFilterEnum.noiseReduction: @"NOISE_REDUCTION",
|
|
673
|
-
THETACThetaRepositoryFilterEnum.hdr: @"HDR"
|
|
1182
|
+
THETACThetaRepositoryFilterEnum.hdr: @"HDR",
|
|
1183
|
+
THETACThetaRepositoryFilterEnum.hhHdr: @"HH_HDR"
|
|
674
1184
|
},
|
|
675
1185
|
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
676
1186
|
id val = [FilterEnum.toTheta objectForKey:[rct objectForKey:@"filter"]];
|
|
@@ -711,6 +1221,12 @@ static convert_t GpsTagRecordingEnum = {
|
|
|
711
1221
|
[builder setGpsTagRecordingValue:val];
|
|
712
1222
|
}
|
|
713
1223
|
},
|
|
1224
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
1225
|
+
id val = [GpsTagRecordingEnum.toTheta objectForKey:[rct objectForKey:@"_gpsTagRecording"]];
|
|
1226
|
+
if (val) {
|
|
1227
|
+
[builder setGpsTagRecordingValue:val];
|
|
1228
|
+
}
|
|
1229
|
+
},
|
|
714
1230
|
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
715
1231
|
id val = [GpsTagRecordingEnum.toTheta
|
|
716
1232
|
objectForKey:[rct objectForKey:@"_gpsTagRecording"]];
|
|
@@ -792,6 +1308,12 @@ static convert_t IsoEnum = {
|
|
|
792
1308
|
[builder setIsoIso:val];
|
|
793
1309
|
}
|
|
794
1310
|
},
|
|
1311
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
1312
|
+
id val = [IsoEnum.toTheta objectForKey:[rct objectForKey:@"iso"]];
|
|
1313
|
+
if (val) {
|
|
1314
|
+
[builder setIsoIso:val];
|
|
1315
|
+
}
|
|
1316
|
+
},
|
|
795
1317
|
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
796
1318
|
id val = [IsoEnum.toTheta objectForKey:[rct objectForKey:@"iso"]];
|
|
797
1319
|
if (val) {
|
|
@@ -866,6 +1388,12 @@ static convert_t IsoAutoHighLimitEnum = {
|
|
|
866
1388
|
[builder setIsoAutoHighLimitIso:val];
|
|
867
1389
|
}
|
|
868
1390
|
},
|
|
1391
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
1392
|
+
id val = [IsoAutoHighLimitEnum.toTheta objectForKey:[rct objectForKey:@"isoAutoHighLimit"]];
|
|
1393
|
+
if (val) {
|
|
1394
|
+
[builder setIsoAutoHighLimitIso:val];
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
869
1397
|
.setVideoOption = ^(NSDictionary* rct, THETACVideoCaptureBuilder *builder) {
|
|
870
1398
|
id val = [IsoAutoHighLimitEnum.toTheta
|
|
871
1399
|
objectForKey:[rct objectForKey:@"isoAutoHighLimit"]];
|
|
@@ -922,12 +1450,16 @@ static convert_t MaxRecordableTimeEnum = {
|
|
|
922
1450
|
.toTheta = @{
|
|
923
1451
|
@"RECORDABLE_TIME_180": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime180,
|
|
924
1452
|
@"RECORDABLE_TIME_300": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime300,
|
|
925
|
-
@"RECORDABLE_TIME_1500": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime1500
|
|
1453
|
+
@"RECORDABLE_TIME_1500": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime1500,
|
|
1454
|
+
@"RECORDABLE_TIME_7200": THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime7200,
|
|
1455
|
+
@"DO_NOT_UPDATE_MY_SETTING_CONDITION": THETACThetaRepositoryMaxRecordableTimeEnum.doNotUpdateMySettingCondition
|
|
926
1456
|
},
|
|
927
1457
|
.fromTheta = @{
|
|
928
1458
|
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime180: @"RECORDABLE_TIME_180",
|
|
929
1459
|
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime300: @"RECORDABLE_TIME_300",
|
|
930
|
-
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime1500: @"RECORDABLE_TIME_1500"
|
|
1460
|
+
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime1500: @"RECORDABLE_TIME_1500",
|
|
1461
|
+
THETACThetaRepositoryMaxRecordableTimeEnum.recordableTime7200: @"RECORDABLE_TIME_7200",
|
|
1462
|
+
THETACThetaRepositoryMaxRecordableTimeEnum.doNotUpdateMySettingCondition: @"DO_NOT_UPDATE_MY_SETTING_CONDITION"
|
|
931
1463
|
},
|
|
932
1464
|
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
933
1465
|
id val = [MaxRecordableTimeEnum.toTheta
|
|
@@ -993,6 +1525,71 @@ static convert_t OffDelayEnum = {
|
|
|
993
1525
|
}
|
|
994
1526
|
};
|
|
995
1527
|
|
|
1528
|
+
/**
|
|
1529
|
+
* PowerSaving convertor
|
|
1530
|
+
*/
|
|
1531
|
+
static convert_t PowerSavingEnum = {
|
|
1532
|
+
.toTheta = @{
|
|
1533
|
+
@"ON": THETACThetaRepositoryPowerSavingEnum.on,
|
|
1534
|
+
@"OFF": THETACThetaRepositoryPowerSavingEnum.off
|
|
1535
|
+
},
|
|
1536
|
+
.fromTheta = @{
|
|
1537
|
+
THETACThetaRepositoryPowerSavingEnum.on: @"ON",
|
|
1538
|
+
THETACThetaRepositoryPowerSavingEnum.off: @"OFF"
|
|
1539
|
+
},
|
|
1540
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1541
|
+
id val = [PowerSavingEnum.toTheta objectForKey:[rct objectForKey:@"powerSaving"]];
|
|
1542
|
+
if (val) {
|
|
1543
|
+
opt.powerSaving = val;
|
|
1544
|
+
}
|
|
1545
|
+
},
|
|
1546
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1547
|
+
id val = [PowerSavingEnum.fromTheta objectForKey:opt.powerSaving];
|
|
1548
|
+
if (val) {
|
|
1549
|
+
[rct setObject:val forKey:@"powerSaving"];
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* PreviewFormat convertor
|
|
1556
|
+
*/
|
|
1557
|
+
static convert_t PreviewFormatEnum = {
|
|
1558
|
+
.toTheta = @{
|
|
1559
|
+
@"W1024_H512_F30": THETACThetaRepositoryPreviewFormatEnum.w1024H512F30,
|
|
1560
|
+
@"W1024_H512_F15": THETACThetaRepositoryPreviewFormatEnum.w1024H512F15,
|
|
1561
|
+
@"W512_H512_F30": THETACThetaRepositoryPreviewFormatEnum.w512H512F30,
|
|
1562
|
+
@"W1920_H960_F8": THETACThetaRepositoryPreviewFormatEnum.w1920H960F8,
|
|
1563
|
+
@"W1024_H512_F8": THETACThetaRepositoryPreviewFormatEnum.w1024H512F8,
|
|
1564
|
+
@"W640_H320_F30": THETACThetaRepositoryPreviewFormatEnum.w640H320F30,
|
|
1565
|
+
@"W640_H320_F8": THETACThetaRepositoryPreviewFormatEnum.w640H320F8,
|
|
1566
|
+
@"W640_H320_F10": THETACThetaRepositoryPreviewFormatEnum.w640H320F10
|
|
1567
|
+
},
|
|
1568
|
+
.fromTheta = @{
|
|
1569
|
+
THETACThetaRepositoryPreviewFormatEnum.w1024H512F30: @"W1024_H512_F30",
|
|
1570
|
+
THETACThetaRepositoryPreviewFormatEnum.w1024H512F15: @"W1024_H512_F15",
|
|
1571
|
+
THETACThetaRepositoryPreviewFormatEnum.w512H512F30: @"W512_H512_F30",
|
|
1572
|
+
THETACThetaRepositoryPreviewFormatEnum.w1920H960F8: @"W1920_H960_F8",
|
|
1573
|
+
THETACThetaRepositoryPreviewFormatEnum.w1024H512F8: @"W1024_H512_F8",
|
|
1574
|
+
THETACThetaRepositoryPreviewFormatEnum.w640H320F30: @"W640_H320_F30",
|
|
1575
|
+
THETACThetaRepositoryPreviewFormatEnum.w640H320F8: @"W640_H320_F8",
|
|
1576
|
+
THETACThetaRepositoryPreviewFormatEnum.w640H320F10: @"W640_H320_F10",
|
|
1577
|
+
},
|
|
1578
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1579
|
+
id val = [PreviewFormatEnum.toTheta objectForKey:[rct objectForKey:@"previewFormat"]];
|
|
1580
|
+
if (val) {
|
|
1581
|
+
opt.previewFormat = val;
|
|
1582
|
+
}
|
|
1583
|
+
},
|
|
1584
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1585
|
+
id val = [PreviewFormatEnum.fromTheta objectForKey:opt.previewFormat];
|
|
1586
|
+
if (val) {
|
|
1587
|
+
[rct setObject:val forKey:@"previewFormat"];
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
|
|
996
1593
|
/**
|
|
997
1594
|
* WhiteBalanceEnum converter
|
|
998
1595
|
*/
|
|
@@ -1109,6 +1706,40 @@ static convert_t ColorTemperatureCvt = {
|
|
|
1109
1706
|
}
|
|
1110
1707
|
};
|
|
1111
1708
|
|
|
1709
|
+
/**
|
|
1710
|
+
* CompositeShootingOutputInterval converter
|
|
1711
|
+
*/
|
|
1712
|
+
static convert_t CompositeShootingOutputIntervalCvt = {
|
|
1713
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1714
|
+
NSNumber* val = [rct objectForKey:@"compositeShootingOutputInterval"];
|
|
1715
|
+
if (val) {
|
|
1716
|
+
opt.compositeShootingOutputInterval = [THETACInt numberWithInt:[val intValue]];
|
|
1717
|
+
}
|
|
1718
|
+
},
|
|
1719
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1720
|
+
if (opt.compositeShootingOutputInterval) {
|
|
1721
|
+
[rct setObject:opt.compositeShootingOutputInterval forKey:@"compositeShootingOutputInterval"];
|
|
1722
|
+
}
|
|
1723
|
+
},
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* CompositeShootingTime converter
|
|
1728
|
+
*/
|
|
1729
|
+
static convert_t CompositeShootingTimeCvt = {
|
|
1730
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1731
|
+
NSNumber* val = [rct objectForKey:@"compositeShootingTime"];
|
|
1732
|
+
if (val) {
|
|
1733
|
+
opt.compositeShootingTime = [THETACInt numberWithInt:[val intValue]];
|
|
1734
|
+
}
|
|
1735
|
+
},
|
|
1736
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1737
|
+
if (opt.compositeShootingTime) {
|
|
1738
|
+
[rct setObject:opt.compositeShootingTime forKey:@"compositeShootingTime"];
|
|
1739
|
+
}
|
|
1740
|
+
},
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1112
1743
|
/**
|
|
1113
1744
|
* DateTimeZone converter
|
|
1114
1745
|
*/
|
|
@@ -1143,6 +1774,44 @@ static convert_t IsGpsOnCvt = {
|
|
|
1143
1774
|
}
|
|
1144
1775
|
};
|
|
1145
1776
|
|
|
1777
|
+
/**
|
|
1778
|
+
* ShutterSpeed converter
|
|
1779
|
+
*/
|
|
1780
|
+
static convert_t ShutterSpeedEnum = {
|
|
1781
|
+
.toTheta = nil,
|
|
1782
|
+
.fromTheta = nil,
|
|
1783
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1784
|
+
if (!ShutterSpeedEnum.toTheta) {
|
|
1785
|
+
NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
|
|
1786
|
+
THETACKotlinArray* array = THETACThetaRepositoryShutterSpeedEnum.values;
|
|
1787
|
+
for (int i = 0; i < array.size; i++) {
|
|
1788
|
+
THETACThetaRepositorySleepDelayEnum* item = [array getIndex:i];
|
|
1789
|
+
[dictionary setObject:item forKey:item.name];
|
|
1790
|
+
}
|
|
1791
|
+
ShutterSpeedEnum.toTheta = dictionary;
|
|
1792
|
+
}
|
|
1793
|
+
id val = [ShutterSpeedEnum.toTheta objectForKey:[rct objectForKey:@"shutterSpeed"]];
|
|
1794
|
+
if (val) {
|
|
1795
|
+
opt.shutterSpeed = val;
|
|
1796
|
+
}
|
|
1797
|
+
},
|
|
1798
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1799
|
+
if (!ShutterSpeedEnum.fromTheta) {
|
|
1800
|
+
NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
|
|
1801
|
+
THETACKotlinArray* array = THETACThetaRepositoryShutterSpeedEnum.values;
|
|
1802
|
+
for (int i = 0; i < array.size; i++) {
|
|
1803
|
+
THETACThetaRepositorySleepDelayEnum* item = [array getIndex:i];
|
|
1804
|
+
[dictionary setObject:item.name forKey:item];
|
|
1805
|
+
}
|
|
1806
|
+
ShutterSpeedEnum.fromTheta = dictionary;
|
|
1807
|
+
}
|
|
1808
|
+
id val = [ShutterSpeedEnum.fromTheta objectForKey:opt.shutterSpeed];
|
|
1809
|
+
if (val) {
|
|
1810
|
+
[rct setObject:val forKey:@"shutterSpeed"];
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
|
|
1146
1815
|
/**
|
|
1147
1816
|
* SleepDelay converter
|
|
1148
1817
|
*/
|
|
@@ -1250,51 +1919,329 @@ static convert_t TotalSpaceCvt = {
|
|
|
1250
1919
|
if (opt.totalSpace) {
|
|
1251
1920
|
[rct setObject:opt.totalSpace forKey:@"totalSpace"];
|
|
1252
1921
|
}
|
|
1253
|
-
}
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* ShutterVolume converter
|
|
1927
|
+
*/
|
|
1928
|
+
static convert_t ShutterVolumeCvt = {
|
|
1929
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1930
|
+
NSNumber* val = [rct objectForKey:@"shutterVolume"];
|
|
1931
|
+
if (val) {
|
|
1932
|
+
opt.shutterVolume = [THETACInt numberWithInt:[val intValue]];
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1935
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1936
|
+
if (opt.shutterVolume) {
|
|
1937
|
+
[rct setObject:opt.shutterVolume forKey:@"shutterVolume"];
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* GpsInfo converter
|
|
1944
|
+
*/
|
|
1945
|
+
static convert_t GpsInfoCvt = {
|
|
1946
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1947
|
+
NSDictionary *gpsInfoDict = [rct objectForKey:@"gpsInfo"];
|
|
1948
|
+
if (gpsInfoDict) {
|
|
1949
|
+
opt.gpsInfo =
|
|
1950
|
+
[[THETACThetaRepositoryGpsInfo alloc]
|
|
1951
|
+
initWithLatitude:((NSNumber*) [gpsInfoDict objectForKey:@"latitude"]).floatValue
|
|
1952
|
+
longitude:((NSNumber*) [gpsInfoDict objectForKey:@"longitude"]).floatValue
|
|
1953
|
+
altitude:((NSNumber*) [gpsInfoDict objectForKey:@"altitude"]).floatValue
|
|
1954
|
+
dateTimeZone:[gpsInfoDict objectForKey:@"dateTimeZone"]];
|
|
1955
|
+
}
|
|
1956
|
+
},
|
|
1957
|
+
|
|
1958
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1959
|
+
if (opt.gpsInfo) {
|
|
1960
|
+
NSDictionary *gpsInfo = @{
|
|
1961
|
+
@"latitude": @(opt.gpsInfo.latitude),
|
|
1962
|
+
@"longitude": @(opt.gpsInfo.longitude),
|
|
1963
|
+
@"altitude": @(opt.gpsInfo.altitude),
|
|
1964
|
+
@"dateTimeZone": opt.gpsInfo.dateTimeZone
|
|
1965
|
+
};
|
|
1966
|
+
[rct setObject:gpsInfo forKey:@"gpsInfo"];
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
};
|
|
1970
|
+
|
|
1971
|
+
/**
|
|
1972
|
+
* NetworkType converter
|
|
1973
|
+
*/
|
|
1974
|
+
static convert_t NetworkTypeEnum = {
|
|
1975
|
+
.toTheta = @{
|
|
1976
|
+
@"DIRECT": THETACThetaRepositoryNetworkTypeEnum.direct,
|
|
1977
|
+
@"CLIENT": THETACThetaRepositoryNetworkTypeEnum.client,
|
|
1978
|
+
@"ETHERNET": THETACThetaRepositoryNetworkTypeEnum.ethernet,
|
|
1979
|
+
@"OFF": THETACThetaRepositoryNetworkTypeEnum.off
|
|
1980
|
+
},
|
|
1981
|
+
.fromTheta = @{
|
|
1982
|
+
THETACThetaRepositoryNetworkTypeEnum.direct: @"DIRECT",
|
|
1983
|
+
THETACThetaRepositoryNetworkTypeEnum.client: @"CLIENT",
|
|
1984
|
+
THETACThetaRepositoryNetworkTypeEnum.ethernet: @"ETHERNET",
|
|
1985
|
+
THETACThetaRepositoryNetworkTypeEnum.off: @"OFF"
|
|
1986
|
+
},
|
|
1987
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1988
|
+
id val = [NetworkTypeEnum.toTheta objectForKey:[rct objectForKey:@"networkType"]];
|
|
1989
|
+
if (val) {
|
|
1990
|
+
opt.networkType = val;
|
|
1991
|
+
}
|
|
1992
|
+
},
|
|
1993
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1994
|
+
id val = [NetworkTypeEnum.fromTheta objectForKey:opt.networkType];
|
|
1995
|
+
if (val) {
|
|
1996
|
+
[rct setObject:val forKey:@"networkType"];
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
2000
|
+
|
|
2001
|
+
/**
|
|
2002
|
+
* WlanFrequency converter
|
|
2003
|
+
*/
|
|
2004
|
+
static convert_t WlanFrequencyEnum = {
|
|
2005
|
+
.toTheta = @{
|
|
2006
|
+
@"GHZ_2_4": THETACThetaRepositoryWlanFrequencyEnum.ghz24,
|
|
2007
|
+
@"GHZ_5": THETACThetaRepositoryWlanFrequencyEnum.ghz5
|
|
2008
|
+
},
|
|
2009
|
+
.fromTheta = @{
|
|
2010
|
+
THETACThetaRepositoryWlanFrequencyEnum.ghz24: @"GHZ_2_4",
|
|
2011
|
+
THETACThetaRepositoryWlanFrequencyEnum.ghz5: @"GHZ_5"
|
|
2012
|
+
},
|
|
2013
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2014
|
+
id val = [WlanFrequencyEnum.toTheta objectForKey:[rct objectForKey:@"wlanFrequency"]];
|
|
2015
|
+
if (val) {
|
|
2016
|
+
opt.wlanFrequency = val;
|
|
2017
|
+
}
|
|
2018
|
+
},
|
|
2019
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2020
|
+
id val = [WlanFrequencyEnum.fromTheta objectForKey:opt.wlanFrequency];
|
|
2021
|
+
if (val) {
|
|
2022
|
+
[rct setObject:val forKey:@"wlanFrequency"];
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
/**
|
|
2028
|
+
* Password converter
|
|
2029
|
+
*/
|
|
2030
|
+
static convert_t PasswordCvt = {
|
|
2031
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2032
|
+
NSString* val = [rct objectForKey:@"password"];
|
|
2033
|
+
if (val) {
|
|
2034
|
+
opt.password = val;
|
|
2035
|
+
}
|
|
2036
|
+
},
|
|
2037
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2038
|
+
if (opt.password) {
|
|
2039
|
+
[rct setObject:opt.password forKey:@"password"];
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
};
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* Preset convertor
|
|
2046
|
+
*/
|
|
2047
|
+
static convert_t PresetEnum = {
|
|
2048
|
+
.toTheta = @{
|
|
2049
|
+
@"FACE": THETACThetaRepositoryPresetEnum.face,
|
|
2050
|
+
@"NIGHT_VIEW": THETACThetaRepositoryPresetEnum.nightView,
|
|
2051
|
+
@"LENS_BY_LENS_EXPOSURE": THETACThetaRepositoryPresetEnum.lensByLensExposure,
|
|
2052
|
+
@"ROOM": THETACThetaRepositoryPresetEnum.room
|
|
2053
|
+
},
|
|
2054
|
+
.fromTheta = @{
|
|
2055
|
+
THETACThetaRepositoryPresetEnum.face: @"FACE",
|
|
2056
|
+
THETACThetaRepositoryPresetEnum.nightView: @"NIGHT_VIEW",
|
|
2057
|
+
THETACThetaRepositoryPresetEnum.lensByLensExposure: @"LENS_BY_LENS_EXPOSURE",
|
|
2058
|
+
THETACThetaRepositoryPresetEnum.room: @"ROOM"
|
|
2059
|
+
},
|
|
2060
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2061
|
+
id val = [PresetEnum.toTheta objectForKey:[rct objectForKey:@"preset"]];
|
|
2062
|
+
if (val) {
|
|
2063
|
+
opt.preset = val;
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2067
|
+
id val = [PresetEnum.fromTheta objectForKey:opt.preset];
|
|
2068
|
+
if (val) {
|
|
2069
|
+
[rct setObject:val forKey:@"preset"];
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
};
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* Proxy converter
|
|
2077
|
+
*/
|
|
2078
|
+
static convert_t ProxyCvt = {
|
|
2079
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2080
|
+
NSDictionary *proxyDic = [rct objectForKey:@"proxy"];
|
|
2081
|
+
if (proxyDic) {
|
|
2082
|
+
opt.proxy = [[THETACThetaRepositoryProxy alloc]
|
|
2083
|
+
initWithUse:!isNull([proxyDic objectForKey:@"use"]) ? ((NSNumber*) [proxyDic objectForKey:@"use"]).boolValue : NO
|
|
2084
|
+
url:!isNull([proxyDic objectForKey:@"url"]) ? [proxyDic objectForKey:@"url"] : nil
|
|
2085
|
+
port:!isNull([proxyDic objectForKey:@"port"]) ? [THETACInt numberWithInt:((NSNumber*) [proxyDic objectForKey:@"port"]).intValue] : nil
|
|
2086
|
+
userid:!isNull([proxyDic objectForKey:@"userid"]) ? [proxyDic objectForKey:@"userid"] : nil
|
|
2087
|
+
password:!isNull([proxyDic objectForKey:@"password"]) ? [proxyDic objectForKey:@"password"] : nil];
|
|
2088
|
+
}
|
|
2089
|
+
},
|
|
2090
|
+
|
|
2091
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2092
|
+
if (opt.proxy) {
|
|
2093
|
+
NSMutableDictionary *proxy = [NSMutableDictionary dictionary];
|
|
2094
|
+
|
|
2095
|
+
[proxy setObject:@(opt.proxy.use) forKey:@"use"];
|
|
2096
|
+
|
|
2097
|
+
if (opt.proxy.url) {
|
|
2098
|
+
[proxy setObject:opt.proxy.url forKey:@"url"];
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
if (opt.proxy.port) {
|
|
2102
|
+
[proxy setObject:@(opt.proxy.port.intValue) forKey:@"port"];
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
if (opt.proxy.userid) {
|
|
2106
|
+
[proxy setObject:opt.proxy.userid forKey:@"userid"];
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
if (opt.proxy.password) {
|
|
2110
|
+
[proxy setObject:opt.proxy.password forKey:@"password"];
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
[rct setObject:proxy forKey:@"proxy"];
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
};
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* TimeShift converter
|
|
2120
|
+
*/
|
|
2121
|
+
static convert_t TimeShiftCvt = {
|
|
2122
|
+
.toTheta = @{
|
|
2123
|
+
@"INTERVAL_0": THETACThetaRepositoryTimeShiftIntervalEnum.interval0,
|
|
2124
|
+
@"INTERVAL_1": THETACThetaRepositoryTimeShiftIntervalEnum.interval1,
|
|
2125
|
+
@"INTERVAL_2": THETACThetaRepositoryTimeShiftIntervalEnum.interval2,
|
|
2126
|
+
@"INTERVAL_3": THETACThetaRepositoryTimeShiftIntervalEnum.interval3,
|
|
2127
|
+
@"INTERVAL_4": THETACThetaRepositoryTimeShiftIntervalEnum.interval4,
|
|
2128
|
+
@"INTERVAL_5": THETACThetaRepositoryTimeShiftIntervalEnum.interval5,
|
|
2129
|
+
@"INTERVAL_6": THETACThetaRepositoryTimeShiftIntervalEnum.interval6,
|
|
2130
|
+
@"INTERVAL_7": THETACThetaRepositoryTimeShiftIntervalEnum.interval7,
|
|
2131
|
+
@"INTERVAL_8": THETACThetaRepositoryTimeShiftIntervalEnum.interval8,
|
|
2132
|
+
@"INTERVAL_9": THETACThetaRepositoryTimeShiftIntervalEnum.interval9,
|
|
2133
|
+
@"INTERVAL_10": THETACThetaRepositoryTimeShiftIntervalEnum.interval10
|
|
2134
|
+
},
|
|
2135
|
+
.fromTheta = @{
|
|
2136
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval0: @"INTERVAL_0",
|
|
2137
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval1: @"INTERVAL_1",
|
|
2138
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval2: @"INTERVAL_2",
|
|
2139
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval3: @"INTERVAL_3",
|
|
2140
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval4: @"INTERVAL_4",
|
|
2141
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval5: @"INTERVAL_5",
|
|
2142
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval6: @"INTERVAL_6",
|
|
2143
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval7: @"INTERVAL_7",
|
|
2144
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval8: @"INTERVAL_8",
|
|
2145
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval9: @"INTERVAL_9",
|
|
2146
|
+
THETACThetaRepositoryTimeShiftIntervalEnum.interval10: @"INTERVAL_10"
|
|
2147
|
+
},
|
|
2148
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2149
|
+
NSDictionary *timeshiftDic = [rct objectForKey:@"timeShift"];
|
|
2150
|
+
if (timeshiftDic) {
|
|
2151
|
+
opt.timeShift = [[THETACThetaRepositoryTimeShiftSetting alloc]
|
|
2152
|
+
initWithIsFrontFirst:!isNull([timeshiftDic objectForKey:@"isFrontFirst"]) ? [THETACBoolean numberWithBool:((NSNumber*) [timeshiftDic objectForKey:@"isFrontFirst"]).boolValue] : nil
|
|
2153
|
+
firstInterval:!isNull([timeshiftDic objectForKey:@"firstInterval"]) ? [TimeShiftCvt.toTheta objectForKey:[timeshiftDic objectForKey:@"firstInterval"]] : nil
|
|
2154
|
+
secondInterval:!isNull([timeshiftDic objectForKey:@"secondInterval"]) ? [TimeShiftCvt.toTheta objectForKey:[timeshiftDic objectForKey:@"secondInterval"]] : nil];
|
|
2155
|
+
}
|
|
2156
|
+
},
|
|
2157
|
+
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2158
|
+
if (opt.timeShift) {
|
|
2159
|
+
NSMutableDictionary *timeshift = [NSMutableDictionary dictionary];
|
|
2160
|
+
|
|
2161
|
+
if (opt.timeShift.isFrontFirst) {
|
|
2162
|
+
[timeshift setObject:@(((NSNumber *) opt.timeShift.isFrontFirst).boolValue) forKey:@"isFrontFirst"];
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
if (opt.timeShift.firstInterval) {
|
|
2166
|
+
[timeshift setObject:[TimeShiftCvt.fromTheta objectForKey:opt.timeShift.firstInterval] forKey:@"firstInterval"];
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
if (opt.timeShift.secondInterval) {
|
|
2170
|
+
[timeshift setObject:[TimeShiftCvt.fromTheta objectForKey:opt.timeShift.secondInterval] forKey:@"secondInterval"];
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
[rct setObject:timeshift forKey:@"timeShift"];
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
.setTimeShiftOption = ^(NSDictionary* rct, THETACTimeShiftCaptureBuilder *builder) {
|
|
2177
|
+
NSDictionary *timeshiftDic = [rct objectForKey:@"timeShift"];
|
|
2178
|
+
if (timeshiftDic) {
|
|
2179
|
+
[builder setIsFrontFirstIsFrontFirst:!isNull([timeshiftDic objectForKey:@"isFrontFirst"]) ? [THETACBoolean numberWithBool:((NSNumber*) [timeshiftDic objectForKey:@"isFrontFirst"]).boolValue] : nil];
|
|
2180
|
+
[builder setFirstIntervalInterval:!isNull([timeshiftDic objectForKey:@"firstInterval"]) ? [TimeShiftCvt.toTheta objectForKey:[timeshiftDic objectForKey:@"firstInterval"]] : nil];
|
|
2181
|
+
[builder setSecondIntervalInterval:!isNull([timeshiftDic objectForKey:@"secondInterval"]) ? [TimeShiftCvt.toTheta objectForKey:[timeshiftDic objectForKey:@"secondInterval"]] : nil];
|
|
2182
|
+
}
|
|
2183
|
+
},
|
|
1254
2184
|
};
|
|
1255
2185
|
|
|
1256
2186
|
/**
|
|
1257
|
-
*
|
|
2187
|
+
* ShootingMethod convertor
|
|
1258
2188
|
*/
|
|
1259
|
-
static convert_t
|
|
2189
|
+
static convert_t ShootingMethodEnum = {
|
|
2190
|
+
.toTheta = @{
|
|
2191
|
+
@"NORMAL": THETACThetaRepositoryShootingMethodEnum.normal,
|
|
2192
|
+
@"INTERVAL": THETACThetaRepositoryShootingMethodEnum.interval,
|
|
2193
|
+
@"MOVE_INTERVAL": THETACThetaRepositoryShootingMethodEnum.moveInterval,
|
|
2194
|
+
@"FIXED_INTERVAL": THETACThetaRepositoryShootingMethodEnum.fixedInterval,
|
|
2195
|
+
@"BRACKET": THETACThetaRepositoryShootingMethodEnum.bracket,
|
|
2196
|
+
@"COMPOSITE": THETACThetaRepositoryShootingMethodEnum.composite,
|
|
2197
|
+
@"CONTINUOUS": THETACThetaRepositoryShootingMethodEnum.continuous,
|
|
2198
|
+
@"TIME_SHIFT": THETACThetaRepositoryShootingMethodEnum.timeShift,
|
|
2199
|
+
@"BURST": THETACThetaRepositoryShootingMethodEnum.burst,
|
|
2200
|
+
},
|
|
2201
|
+
.fromTheta = @{
|
|
2202
|
+
THETACThetaRepositoryShootingMethodEnum.normal: @"NORMAL",
|
|
2203
|
+
THETACThetaRepositoryShootingMethodEnum.interval: @"INTERVAL",
|
|
2204
|
+
THETACThetaRepositoryShootingMethodEnum.moveInterval: @"MOVE_INTERVAL",
|
|
2205
|
+
THETACThetaRepositoryShootingMethodEnum.fixedInterval: @"FIXED_INTERVAL",
|
|
2206
|
+
THETACThetaRepositoryShootingMethodEnum.bracket: @"BRACKET",
|
|
2207
|
+
THETACThetaRepositoryShootingMethodEnum.composite: @"COMPOSITE",
|
|
2208
|
+
THETACThetaRepositoryShootingMethodEnum.continuous: @"CONTINUOUS",
|
|
2209
|
+
THETACThetaRepositoryShootingMethodEnum.timeShift: @"TIME_SHIFT",
|
|
2210
|
+
THETACThetaRepositoryShootingMethodEnum.burst: @"BURST",
|
|
2211
|
+
},
|
|
1260
2212
|
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1261
|
-
|
|
2213
|
+
id val = [ShootingMethodEnum.toTheta objectForKey:[rct objectForKey:@"shootingMethod"]];
|
|
1262
2214
|
if (val) {
|
|
1263
|
-
opt.
|
|
2215
|
+
opt.shootingMethod = val;
|
|
2216
|
+
}
|
|
2217
|
+
},
|
|
2218
|
+
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
2219
|
+
id val = [ShootingMethodEnum.toTheta objectForKey:[rct objectForKey:@"shootingMethod"]];
|
|
2220
|
+
if (val) {
|
|
2221
|
+
opt.shootingMethod = val;
|
|
1264
2222
|
}
|
|
1265
2223
|
},
|
|
1266
2224
|
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1267
|
-
|
|
1268
|
-
|
|
2225
|
+
id val = [ShootingMethodEnum.fromTheta objectForKey:opt.shootingMethod];
|
|
2226
|
+
if (val) {
|
|
2227
|
+
[rct setObject:val forKey:@"shootingMethod"];
|
|
1269
2228
|
}
|
|
1270
2229
|
}
|
|
1271
2230
|
};
|
|
1272
2231
|
|
|
1273
2232
|
/**
|
|
1274
|
-
*
|
|
2233
|
+
* Username converter
|
|
1275
2234
|
*/
|
|
1276
|
-
static convert_t
|
|
2235
|
+
static convert_t UsernameCvt = {
|
|
1277
2236
|
.setToTheta = ^(NSDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1278
|
-
|
|
1279
|
-
if (
|
|
1280
|
-
opt.
|
|
1281
|
-
[[THETACThetaRepositoryGpsInfo alloc]
|
|
1282
|
-
initWithLatitude:((NSNumber*) [gpsInfoDict objectForKey:@"latitude"]).floatValue
|
|
1283
|
-
longitude:((NSNumber*) [gpsInfoDict objectForKey:@"longitude"]).floatValue
|
|
1284
|
-
altitude:((NSNumber*) [gpsInfoDict objectForKey:@"altitude"]).floatValue
|
|
1285
|
-
dateTimeZone:[gpsInfoDict objectForKey:@"dateTimeZone"]];
|
|
2237
|
+
NSString* val = [rct objectForKey:@"username"];
|
|
2238
|
+
if (val) {
|
|
2239
|
+
opt.username = val;
|
|
1286
2240
|
}
|
|
1287
2241
|
},
|
|
1288
|
-
|
|
1289
2242
|
.setFromTheta = ^(NSMutableDictionary* rct, THETACThetaRepositoryOptions *opt) {
|
|
1290
|
-
if (opt.
|
|
1291
|
-
|
|
1292
|
-
@"latitude": @(opt.gpsInfo.latitude),
|
|
1293
|
-
@"longitude": @(opt.gpsInfo.longitude),
|
|
1294
|
-
@"altitude": @(opt.gpsInfo.altitude),
|
|
1295
|
-
@"dateTimeZone": opt.gpsInfo.dateTimeZone
|
|
1296
|
-
};
|
|
1297
|
-
[rct setObject:gpsInfo forKey:@"gpsInfo"];
|
|
2243
|
+
if (opt.username) {
|
|
2244
|
+
[rct setObject:opt.username forKey:@"username"];
|
|
1298
2245
|
}
|
|
1299
2246
|
}
|
|
1300
2247
|
};
|
|
@@ -1303,10 +2250,21 @@ static convert_t GpsInfoCvt = {
|
|
|
1303
2250
|
* OptionNames converter
|
|
1304
2251
|
*/
|
|
1305
2252
|
static NSDictionary *NameToOptionEnum = @{
|
|
2253
|
+
@"AiAutoThumbnail": THETACThetaRepositoryOptionNameEnum.aiautothumbnail,
|
|
1306
2254
|
@"Aperture": THETACThetaRepositoryOptionNameEnum.aperture,
|
|
2255
|
+
@"Bitrate": THETACThetaRepositoryOptionNameEnum.bitrate,
|
|
1307
2256
|
@"BluetoothPower": THETACThetaRepositoryOptionNameEnum.bluetoothpower,
|
|
2257
|
+
@"BurstMode": THETACThetaRepositoryOptionNameEnum.burstmode,
|
|
2258
|
+
@"BurstOption": THETACThetaRepositoryOptionNameEnum.burstoption,
|
|
2259
|
+
@"CameraControlSource": THETACThetaRepositoryOptionNameEnum.cameracontrolsource,
|
|
2260
|
+
@"CameraMode": THETACThetaRepositoryOptionNameEnum.cameramode,
|
|
2261
|
+
@"CaptureInterval": THETACThetaRepositoryOptionNameEnum.captureinterval,
|
|
1308
2262
|
@"CaptureMode": THETACThetaRepositoryOptionNameEnum.capturemode,
|
|
2263
|
+
@"CaptureNumber": THETACThetaRepositoryOptionNameEnum.capturenumber,
|
|
1309
2264
|
@"ColorTemperature": THETACThetaRepositoryOptionNameEnum.colortemperature,
|
|
2265
|
+
@"CompositeShootingOutputInterval": THETACThetaRepositoryOptionNameEnum.compositeshootingoutputinterval,
|
|
2266
|
+
@"CompositeShootingTime": THETACThetaRepositoryOptionNameEnum.compositeshootingtime,
|
|
2267
|
+
@"ContinuousNumber": THETACThetaRepositoryOptionNameEnum.continuousnumber,
|
|
1310
2268
|
@"DateTimeZone": THETACThetaRepositoryOptionNameEnum.datetimezone,
|
|
1311
2269
|
@"ExposureCompensation": THETACThetaRepositoryOptionNameEnum.exposurecompensation,
|
|
1312
2270
|
@"ExposureDelay": THETACThetaRepositoryOptionNameEnum.exposuredelay,
|
|
@@ -1319,25 +2277,47 @@ static NSDictionary *NameToOptionEnum = @{
|
|
|
1319
2277
|
@"IsoAutoHighLimit": THETACThetaRepositoryOptionNameEnum.isoautohighlimit,
|
|
1320
2278
|
@"Language": THETACThetaRepositoryOptionNameEnum.language,
|
|
1321
2279
|
@"MaxRecordableTime": THETACThetaRepositoryOptionNameEnum.maxrecordabletime,
|
|
2280
|
+
@"NetworkType": THETACThetaRepositoryOptionNameEnum.networktype,
|
|
1322
2281
|
@"OffDelay": THETACThetaRepositoryOptionNameEnum.offdelay,
|
|
2282
|
+
@"Password": THETACThetaRepositoryOptionNameEnum.password,
|
|
2283
|
+
@"PowerSaving": THETACThetaRepositoryOptionNameEnum.powersaving,
|
|
2284
|
+
@"Preset": THETACThetaRepositoryOptionNameEnum.preset,
|
|
2285
|
+
@"PreviewFormat": THETACThetaRepositoryOptionNameEnum.previewformat,
|
|
2286
|
+
@"Proxy": THETACThetaRepositoryOptionNameEnum.proxy,
|
|
2287
|
+
@"ShootingMethod": THETACThetaRepositoryOptionNameEnum.shootingmethod,
|
|
2288
|
+
@"ShutterSpeed": THETACThetaRepositoryOptionNameEnum.shutterspeed,
|
|
1323
2289
|
@"SleepDelay": THETACThetaRepositoryOptionNameEnum.sleepdelay,
|
|
1324
2290
|
@"RemainingPictures": THETACThetaRepositoryOptionNameEnum.remainingpictures,
|
|
1325
2291
|
@"RemainingVideoSeconds": THETACThetaRepositoryOptionNameEnum.remainingvideoseconds,
|
|
1326
2292
|
@"RemainingSpace": THETACThetaRepositoryOptionNameEnum.remainingspace,
|
|
2293
|
+
@"TimeShift": THETACThetaRepositoryOptionNameEnum.timeshift,
|
|
1327
2294
|
@"TotalSpace": THETACThetaRepositoryOptionNameEnum.totalspace,
|
|
1328
2295
|
@"ShutterVolume": THETACThetaRepositoryOptionNameEnum.shuttervolume,
|
|
2296
|
+
@"Username": THETACThetaRepositoryOptionNameEnum.username,
|
|
1329
2297
|
@"WhiteBalance": THETACThetaRepositoryOptionNameEnum.whitebalance,
|
|
1330
|
-
@"WhiteBalanceAutoStrength": THETACThetaRepositoryOptionNameEnum.whitebalanceautostrength
|
|
2298
|
+
@"WhiteBalanceAutoStrength": THETACThetaRepositoryOptionNameEnum.whitebalanceautostrength,
|
|
2299
|
+
@"WlanFrequency": THETACThetaRepositoryOptionNameEnum.wlanfrequency
|
|
1331
2300
|
};
|
|
1332
2301
|
|
|
1333
2302
|
/**
|
|
1334
2303
|
* OptionNameEnum to OptionName
|
|
1335
2304
|
*/
|
|
1336
2305
|
static NSDictionary *OptionEnumToOption = @{
|
|
2306
|
+
@"AiAutoThumbnail": @"aiAutoThumbnail",
|
|
1337
2307
|
@"Aperture": @"aperture",
|
|
2308
|
+
@"Bitrate": @"bitrate",
|
|
1338
2309
|
@"BluetoothPower": @"bluetoothPower",
|
|
2310
|
+
@"BurstMode": @"burstMode",
|
|
2311
|
+
@"BurstOption": @"burstOption",
|
|
2312
|
+
@"CameraControlSource": @"cameraControlSource",
|
|
2313
|
+
@"CameraMode": @"cameraMode",
|
|
2314
|
+
@"CaptureInterval": @"captureInterval",
|
|
1339
2315
|
@"CaptureMode": @"captureMode",
|
|
2316
|
+
@"CaptureNumber": @"captureNumber",
|
|
1340
2317
|
@"ColorTemperature": @"colorTemperature",
|
|
2318
|
+
@"CompositeShootingOutputInterval": @"compositeShootingOutputInterval",
|
|
2319
|
+
@"CompositeShootingTime": @"compositeShootingTime",
|
|
2320
|
+
@"ContinuousNumber": @"continuousNumber",
|
|
1341
2321
|
@"DateTimeZone": @"dateTimeZone",
|
|
1342
2322
|
@"ExposureCompensation": @"exposureCompensation",
|
|
1343
2323
|
@"ExposureDelay": @"exposureDelay",
|
|
@@ -1350,15 +2330,26 @@ static NSDictionary *OptionEnumToOption = @{
|
|
|
1350
2330
|
@"IsoAutoHighLimit": @"isoAutoHighLimit",
|
|
1351
2331
|
@"Language": @"language",
|
|
1352
2332
|
@"MaxRecordableTime": @"maxRecordableTime",
|
|
2333
|
+
@"NetworkType": @"networkType",
|
|
1353
2334
|
@"OffDelay": @"offDelay",
|
|
2335
|
+
@"Password": @"password",
|
|
2336
|
+
@"PowerSaving": @"powerSaving",
|
|
2337
|
+
@"Preset": @"preset",
|
|
2338
|
+
@"PreviewFormat": @"previewFormat",
|
|
2339
|
+
@"Proxy": @"proxy",
|
|
2340
|
+
@"ShootingMethod": @"shootingMethod",
|
|
2341
|
+
@"ShutterSpeed": @"shutterSpeed",
|
|
1354
2342
|
@"SleepDelay": @"sleepDelay",
|
|
1355
2343
|
@"RemainingPictures": @"remainingPictures",
|
|
1356
2344
|
@"RemainingVideoSeconds": @"remainingVideoSeconds",
|
|
1357
2345
|
@"RemainingSpace": @"remainingSpace",
|
|
2346
|
+
@"TimeShift": @"timeShift",
|
|
1358
2347
|
@"TotalSpace": @"totalSpace",
|
|
1359
2348
|
@"ShutterVolume": @"shutterVolume",
|
|
2349
|
+
@"Username": @"username",
|
|
1360
2350
|
@"WhiteBalance": @"whiteBalance",
|
|
1361
|
-
@"WhiteBalanceAutoStrength": @"whiteBalanceAutoStrength"
|
|
2351
|
+
@"WhiteBalanceAutoStrength": @"whiteBalanceAutoStrength",
|
|
2352
|
+
@"WlanFrequency": @"wlanFrequency"
|
|
1362
2353
|
};
|
|
1363
2354
|
|
|
1364
2355
|
/** Option converter builder */
|
|
@@ -1368,10 +2359,21 @@ typedef convert_t * (^OptionConverter)();
|
|
|
1368
2359
|
* option converter tables
|
|
1369
2360
|
*/
|
|
1370
2361
|
static NSDictionary<NSString*, OptionConverter> *NameToConverter = @{
|
|
2362
|
+
@"aiAutoThumbnail": ^{return &AiAutoThumbnailEnum;},
|
|
1371
2363
|
@"aperture": ^{return &ApertureEnum;},
|
|
2364
|
+
@"bitrate": ^{return &BitrateEnum;},
|
|
1372
2365
|
@"bluetoothPower": ^{return &BluetoothPowerEnum;},
|
|
2366
|
+
@"burstMode": ^{return &BurstModeEnum;},
|
|
2367
|
+
@"burstOption": ^{return &BurstOptionCvt;},
|
|
2368
|
+
@"cameraControlSource": ^{return &CameraControlSourceEnum;},
|
|
2369
|
+
@"cameraMode": ^{return &CameraModeEnum;},
|
|
2370
|
+
@"captureInterval": ^{return &CaptureIntervalConverter;},
|
|
1373
2371
|
@"captureMode": ^{return &CaptureModeEnum;},
|
|
2372
|
+
@"captureNumber": ^{return &CaptureNumberConverter;},
|
|
1374
2373
|
@"colorTemperature": ^{return &ColorTemperatureCvt;},
|
|
2374
|
+
@"compositeShootingOutputInterval": ^{return &CompositeShootingOutputIntervalCvt;},
|
|
2375
|
+
@"compositeShootingTime": ^{return &CompositeShootingTimeCvt;},
|
|
2376
|
+
@"continuousNumber": ^{return &ContinuousNumberEnum;},
|
|
1375
2377
|
@"dateTimeZone": ^{return &DateTimeZoneCvt;},
|
|
1376
2378
|
@"exposureCompensation": ^{return &ExposureCompensationEnum;},
|
|
1377
2379
|
@"exposureDelay": ^{return &ExposureDelayEnum;},
|
|
@@ -1384,19 +2386,158 @@ static NSDictionary<NSString*, OptionConverter> *NameToConverter = @{
|
|
|
1384
2386
|
@"isoAutoHighLimit": ^{return &IsoAutoHighLimitEnum;},
|
|
1385
2387
|
@"language": ^{return &LanguageEnum;},
|
|
1386
2388
|
@"maxRecordableTime": ^{return &MaxRecordableTimeEnum;},
|
|
2389
|
+
@"networkType": ^{return &NetworkTypeEnum;},
|
|
1387
2390
|
@"offDelay": ^{return &OffDelayEnum;},
|
|
2391
|
+
@"password": ^{return &PasswordCvt;},
|
|
2392
|
+
@"powerSaving": ^{return &PowerSavingEnum;},
|
|
2393
|
+
@"preset": ^{return &PresetEnum;},
|
|
2394
|
+
@"previewFormat": ^{return &PreviewFormatEnum;},
|
|
2395
|
+
@"proxy": ^{return &ProxyCvt;},
|
|
2396
|
+
@"shootingMethod": ^{return &ShootingMethodEnum;},
|
|
2397
|
+
@"shutterSpeed": ^{return &ShutterSpeedEnum;},
|
|
1388
2398
|
@"sleepDelay": ^{return &SleepDelayEnum;},
|
|
1389
2399
|
@"remainingPictures": ^{return &RemainingPicturesCvt;},
|
|
1390
2400
|
@"remainingVideoSeconds": ^{return &RemainingVideoSecondsCvt;},
|
|
1391
2401
|
@"remainingSpace": ^{return &RemainingSpaceCvt;},
|
|
2402
|
+
@"timeShift": ^{return &TimeShiftCvt;},
|
|
1392
2403
|
@"totalSpace": ^{return &TotalSpaceCvt;},
|
|
1393
2404
|
@"shutterVolume": ^{return &ShutterVolumeCvt;},
|
|
2405
|
+
@"username": ^{return &UsernameCvt;},
|
|
1394
2406
|
@"whiteBalance": ^{return &WhiteBalanceEnum;},
|
|
1395
2407
|
@"_gpsTagRecording": ^{return &GpsTagRecordingEnum;},
|
|
1396
|
-
@"whiteBalanceAutoStrength": ^{return &WhiteBalanceAutoStrengthEnum;}
|
|
2408
|
+
@"whiteBalanceAutoStrength": ^{return &WhiteBalanceAutoStrengthEnum;},
|
|
2409
|
+
@"wlanFrequency": ^{return &WlanFrequencyEnum;}
|
|
1397
2410
|
};
|
|
1398
2411
|
|
|
1399
2412
|
static NSString *EVENT_NAME = @"ThetaFrameEvent";
|
|
2413
|
+
static NSString *EVENT_NOTIFY = @"ThetaNotify";
|
|
2414
|
+
|
|
2415
|
+
THETACDigestAuth* digestAuthToTheta(NSDictionary* objects)
|
|
2416
|
+
{
|
|
2417
|
+
if (!objects) {
|
|
2418
|
+
return nil;
|
|
2419
|
+
}
|
|
2420
|
+
NSString* username = [objects objectForKey:@"username"];
|
|
2421
|
+
if (!username) {
|
|
2422
|
+
return nil;
|
|
2423
|
+
}
|
|
2424
|
+
NSString* password = [objects objectForKey:@"password"];
|
|
2425
|
+
THETACDigestAuth* digestAuth = [[THETACDigestAuth alloc] initWithUsername:username password:password];
|
|
2426
|
+
return digestAuth;
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
THETACThetaRepositoryConfig* configToTheta(NSDictionary* objects)
|
|
2430
|
+
{
|
|
2431
|
+
if (!objects) {
|
|
2432
|
+
return nil;
|
|
2433
|
+
}
|
|
2434
|
+
THETACThetaRepositoryConfig* config = [[THETACThetaRepositoryConfig alloc] init];
|
|
2435
|
+
NSString* datetime = [objects objectForKey:@"dateTime"];
|
|
2436
|
+
if (datetime) {
|
|
2437
|
+
config.dateTime = datetime;
|
|
2438
|
+
}
|
|
2439
|
+
id language = [LanguageEnum.toTheta objectForKey:[objects objectForKey:@"language"]];
|
|
2440
|
+
if (language) {
|
|
2441
|
+
config.language = language;
|
|
2442
|
+
}
|
|
2443
|
+
id offDelay = [OffDelayEnum.toTheta objectForKey:[objects objectForKey:@"offDelay"]];
|
|
2444
|
+
if (offDelay) {
|
|
2445
|
+
config.offDelay = offDelay;
|
|
2446
|
+
}
|
|
2447
|
+
id sleepDelay = [SleepDelayEnum.toTheta objectForKey:[objects objectForKey:@"sleepDelay"]];
|
|
2448
|
+
if (sleepDelay) {
|
|
2449
|
+
config.sleepDelay = sleepDelay;
|
|
2450
|
+
}
|
|
2451
|
+
NSNumber* shutterVolume = [objects objectForKey:@"shutterVolume"];
|
|
2452
|
+
if (shutterVolume) {
|
|
2453
|
+
config.shutterVolume = [THETACInt numberWithInt:[shutterVolume intValue]];
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
config.clientMode = digestAuthToTheta([objects objectForKey:@"clientMode"]);
|
|
2457
|
+
|
|
2458
|
+
return config;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
THETACThetaRepositoryTimeout* timeoutToTheta(NSDictionary* objects)
|
|
2462
|
+
{
|
|
2463
|
+
if (!objects) {
|
|
2464
|
+
return nil;
|
|
2465
|
+
}
|
|
2466
|
+
NSNumber* connectTimeout = [objects objectForKey:@"connectTimeout"];
|
|
2467
|
+
NSNumber* requestTimeout = [objects objectForKey:@"requestTimeout"];
|
|
2468
|
+
NSNumber* socketTimeout = [objects objectForKey:@"socketTimeout"];
|
|
2469
|
+
if (!connectTimeout || !requestTimeout || !socketTimeout) {
|
|
2470
|
+
return nil;
|
|
2471
|
+
}
|
|
2472
|
+
THETACThetaRepositoryTimeout* timeout = [[THETACThetaRepositoryTimeout alloc]
|
|
2473
|
+
initWithConnectTimeout:[connectTimeout longValue]
|
|
2474
|
+
requestTimeout:[requestTimeout longLongValue]
|
|
2475
|
+
socketTimeout:[socketTimeout longLongValue]];
|
|
2476
|
+
return timeout;
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
NSDictionary* fileInfoFromTheta(THETACThetaRepositoryFileInfo* fileInfo) {
|
|
2480
|
+
NSMutableDictionary *fileInfoObject = [NSMutableDictionary dictionaryWithDictionary:@{
|
|
2481
|
+
@"name":fileInfo.name,
|
|
2482
|
+
@"fileUrl":fileInfo.fileUrl,
|
|
2483
|
+
@"size":@(fileInfo.size),
|
|
2484
|
+
@"dateTime":fileInfo.dateTime,
|
|
2485
|
+
@"thumbnailUrl":fileInfo.thumbnailUrl
|
|
2486
|
+
}];
|
|
2487
|
+
if (fileInfo.lat) {
|
|
2488
|
+
[fileInfoObject setObject:@(fileInfo.lat.floatValue) forKey:@"lat"];
|
|
2489
|
+
}
|
|
2490
|
+
if (fileInfo.lng) {
|
|
2491
|
+
[fileInfoObject setObject:@(fileInfo.lng.floatValue) forKey:@"lng"];
|
|
2492
|
+
}
|
|
2493
|
+
if (fileInfo.width) {
|
|
2494
|
+
[fileInfoObject setObject:@(fileInfo.width.intValue) forKey:@"width"];
|
|
2495
|
+
}
|
|
2496
|
+
if (fileInfo.height) {
|
|
2497
|
+
[fileInfoObject setObject:@(fileInfo.height.intValue) forKey:@"height"];
|
|
2498
|
+
}
|
|
2499
|
+
if (fileInfo.intervalCaptureGroupId) {
|
|
2500
|
+
[fileInfoObject setObject:fileInfo.intervalCaptureGroupId forKey:@"intervalCaptureGroupId"];
|
|
2501
|
+
}
|
|
2502
|
+
if (fileInfo.compositeShootingGroupId) {
|
|
2503
|
+
[fileInfoObject setObject:fileInfo.compositeShootingGroupId forKey:@"compositeShootingGroupId"];
|
|
2504
|
+
}
|
|
2505
|
+
if (fileInfo.autoBracketGroupId) {
|
|
2506
|
+
[fileInfoObject setObject:fileInfo.autoBracketGroupId forKey:@"autoBracketGroupId"];
|
|
2507
|
+
}
|
|
2508
|
+
if (fileInfo.recordTime) {
|
|
2509
|
+
[fileInfoObject setObject:@(fileInfo.recordTime.intValue) forKey:@"recordTime"];
|
|
2510
|
+
}
|
|
2511
|
+
if (fileInfo.isProcessed) {
|
|
2512
|
+
[fileInfoObject setObject:@(fileInfo.isProcessed.boolValue) forKey:@"isProcessed"];
|
|
2513
|
+
}
|
|
2514
|
+
if (fileInfo.previewUrl) {
|
|
2515
|
+
[fileInfoObject setObject:fileInfo.previewUrl forKey:@"previewUrl"];
|
|
2516
|
+
}
|
|
2517
|
+
if (fileInfo.codec) {
|
|
2518
|
+
[fileInfoObject setObject:fileInfo.codec.name forKey:@"codec"];
|
|
2519
|
+
}
|
|
2520
|
+
if (fileInfo.projectionType) {
|
|
2521
|
+
[fileInfoObject setObject:fileInfo.projectionType.name forKey:@"projectionType"];
|
|
2522
|
+
}
|
|
2523
|
+
if (fileInfo.continuousShootingGroupId) {
|
|
2524
|
+
[fileInfoObject setObject:fileInfo.continuousShootingGroupId forKey:@"continuousShootingGroupId"];
|
|
2525
|
+
}
|
|
2526
|
+
if (fileInfo.frameRate) {
|
|
2527
|
+
[fileInfoObject setObject:@(fileInfo.frameRate.intValue) forKey:@"frameRate"];
|
|
2528
|
+
}
|
|
2529
|
+
if (fileInfo.favorite) {
|
|
2530
|
+
[fileInfoObject setObject:@(fileInfo.favorite.boolValue) forKey:@"favorite"];
|
|
2531
|
+
}
|
|
2532
|
+
if (fileInfo.imageDescription) {
|
|
2533
|
+
[fileInfoObject setObject:fileInfo.imageDescription forKey:@"imageDescription"];
|
|
2534
|
+
}
|
|
2535
|
+
if (fileInfo.storageID) {
|
|
2536
|
+
[fileInfoObject setObject:fileInfo.storageID forKey:@"storageID"];
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
return fileInfoObject;
|
|
2540
|
+
}
|
|
1400
2541
|
|
|
1401
2542
|
/**
|
|
1402
2543
|
* ThetaClientReactNative implementation
|
|
@@ -1435,7 +2576,7 @@ RCT_EXPORT_MODULE(ThetaClientReactNative)
|
|
|
1435
2576
|
*/
|
|
1436
2577
|
-(NSArray *)supportedEvents
|
|
1437
2578
|
{
|
|
1438
|
-
|
|
2579
|
+
return @[EVENT_NAME, EVENT_NOTIFY];
|
|
1439
2580
|
}
|
|
1440
2581
|
|
|
1441
2582
|
/**
|
|
@@ -1457,34 +2598,77 @@ RCT_EXPORT_MODULE(ThetaClientReactNative)
|
|
|
1457
2598
|
/**
|
|
1458
2599
|
* initialize ThetaRepository
|
|
1459
2600
|
* @param endPoint endpoint to connect theta
|
|
2601
|
+
* @param config Configuration of initialize. If null, get from THETA
|
|
2602
|
+
* @param timeout Timeout of HTTP call
|
|
1460
2603
|
* @param resolve resolver for initilization
|
|
1461
2604
|
* @param rejecter rejecter for initialization
|
|
1462
2605
|
*/
|
|
1463
2606
|
RCT_REMAP_METHOD(initialize,
|
|
1464
2607
|
initializeWithEndpoint:(NSString *)endPoint
|
|
2608
|
+
withConfig:(NSDictionary*)config
|
|
2609
|
+
withTimeout:(NSDictionary*)timeout
|
|
1465
2610
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1466
2611
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1467
2612
|
{
|
|
2613
|
+
self.theta = nil;
|
|
2614
|
+
self.photoCaptureBuilder = nil;
|
|
2615
|
+
self.photoCapture = nil;
|
|
2616
|
+
self.timeShiftCaptureBuilder = nil;
|
|
2617
|
+
self.timeShiftCapture = nil;
|
|
2618
|
+
self.timeShiftCapturing = nil;
|
|
2619
|
+
self.videoCaptureBuilder = nil;
|
|
2620
|
+
self.videoCapture = nil;
|
|
2621
|
+
self.videoCapturing = nil;
|
|
2622
|
+
self.previewing = NO;
|
|
2623
|
+
|
|
1468
2624
|
if (!endPoint) {
|
|
1469
2625
|
endPoint = @"http://192.168.1.1";
|
|
1470
2626
|
}
|
|
1471
2627
|
NSError *error = nil;
|
|
1472
2628
|
THETACThetaRepositoryCompanion *companion = THETACThetaRepository.companion;
|
|
1473
2629
|
[companion doNewInstanceEndpoint:endPoint
|
|
1474
|
-
config:
|
|
1475
|
-
timeout:
|
|
2630
|
+
config:configToTheta(config)
|
|
2631
|
+
timeout:timeoutToTheta(timeout)
|
|
1476
2632
|
completionHandler:^(THETACThetaRepository *repo, NSError *error) {
|
|
1477
2633
|
if (error) {
|
|
1478
|
-
reject(
|
|
2634
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1479
2635
|
} else if (repo) {
|
|
1480
2636
|
self.theta = repo;
|
|
1481
2637
|
resolve(@(YES));
|
|
1482
2638
|
} else {
|
|
1483
|
-
reject(
|
|
2639
|
+
reject(ERROR_CODE_ERROR, @"can not create repository", nil);
|
|
1484
2640
|
}
|
|
1485
2641
|
}];
|
|
1486
2642
|
}
|
|
1487
2643
|
|
|
2644
|
+
/**
|
|
2645
|
+
* isInitialized - Returns whether it is initialized or not.
|
|
2646
|
+
* @param resolve is initialized
|
|
2647
|
+
* @param rejecter
|
|
2648
|
+
*/
|
|
2649
|
+
RCT_REMAP_METHOD(isInitialized,
|
|
2650
|
+
isInitializedWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2651
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2652
|
+
{
|
|
2653
|
+
resolve(_theta != nil ? @(YES) : @(NO));
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
/**
|
|
2657
|
+
* getThetaModel - Returns the connected THETA model.
|
|
2658
|
+
* @param resolve for getThetaModel
|
|
2659
|
+
* @param rejecter
|
|
2660
|
+
*/
|
|
2661
|
+
RCT_REMAP_METHOD(getThetaModel,
|
|
2662
|
+
getThetaModelWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2663
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2664
|
+
{
|
|
2665
|
+
if (!_theta) {
|
|
2666
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2669
|
+
resolve(self.theta.cameraModel ? self.theta.cameraModel.name : nil);
|
|
2670
|
+
}
|
|
2671
|
+
|
|
1488
2672
|
/**
|
|
1489
2673
|
* getThetaInfo - retrieve ThetaInfo from THETA via repository
|
|
1490
2674
|
* @param resolve resolver for getThetaInfo
|
|
@@ -1494,33 +2678,43 @@ RCT_REMAP_METHOD(getThetaInfo,
|
|
|
1494
2678
|
getThetaInfoWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1495
2679
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1496
2680
|
{
|
|
2681
|
+
if (!_theta) {
|
|
2682
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2683
|
+
return;
|
|
2684
|
+
}
|
|
1497
2685
|
[_theta getThetaInfoWithCompletionHandler:^(THETACThetaRepositoryThetaInfo *info,
|
|
1498
2686
|
NSError *error) {
|
|
1499
2687
|
if (error) {
|
|
1500
|
-
reject(
|
|
2688
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1501
2689
|
} else if (info) {
|
|
1502
2690
|
NSMutableArray *apiLevelList = [[NSMutableArray alloc] init];
|
|
1503
2691
|
for (THETACInt *element in info.apiLevel) {
|
|
1504
2692
|
[apiLevelList addObject:@([element intValue])];
|
|
1505
2693
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
2694
|
+
NSMutableDictionary *thetaInfoObject = [NSMutableDictionary dictionaryWithDictionary:@{
|
|
2695
|
+
@"manufacturer": info.manufacturer,
|
|
2696
|
+
@"model": info.model,
|
|
2697
|
+
@"serialNumber": info.serialNumber,
|
|
2698
|
+
@"wlanMacAddress": info.wlanMacAddress != nil ? info.wlanMacAddress : [NSNull null],
|
|
2699
|
+
@"bluetoothMacAddress": info.bluetoothMacAddress != nil ? info.bluetoothMacAddress : [NSNull null],
|
|
2700
|
+
@"firmwareVersion": info.firmwareVersion,
|
|
2701
|
+
@"supportUrl": info.supportUrl,
|
|
2702
|
+
@"hasGps": @(info.hasGps),
|
|
2703
|
+
@"hasGyro": @(info.hasGyro),
|
|
2704
|
+
@"uptime": @(info.uptime),
|
|
2705
|
+
@"api": info.api,
|
|
2706
|
+
@"endpoints": @{
|
|
2707
|
+
@"httpPort": @(info.endpoints.httpPort),
|
|
2708
|
+
@"httpUpdatesPort": @(info.endpoints.httpUpdatesPort),
|
|
2709
|
+
},
|
|
2710
|
+
@"apiLevel": apiLevelList
|
|
2711
|
+
}];
|
|
2712
|
+
if (self.theta.cameraModel) {
|
|
2713
|
+
[thetaInfoObject setObject:self.theta.cameraModel.name forKey:@"thetaModel"];
|
|
2714
|
+
}
|
|
2715
|
+
resolve(thetaInfoObject);
|
|
1522
2716
|
} else {
|
|
1523
|
-
reject(
|
|
2717
|
+
reject(ERROR_CODE_ERROR, @"no info", nil);
|
|
1524
2718
|
}
|
|
1525
2719
|
}];
|
|
1526
2720
|
}
|
|
@@ -1534,10 +2728,14 @@ RCT_REMAP_METHOD(getThetaState,
|
|
|
1534
2728
|
getThetaStateWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1535
2729
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1536
2730
|
{
|
|
2731
|
+
if (!_theta) {
|
|
2732
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2733
|
+
return;
|
|
2734
|
+
}
|
|
1537
2735
|
[_theta getThetaStateWithCompletionHandler:^(THETACThetaRepositoryThetaState *state,
|
|
1538
2736
|
NSError *error) {
|
|
1539
2737
|
if (error) {
|
|
1540
|
-
reject(
|
|
2738
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1541
2739
|
} else if (state) {
|
|
1542
2740
|
NSMutableArray *cameraErrorList = [[NSMutableArray alloc] init];
|
|
1543
2741
|
if (state.cameraError != nil) {
|
|
@@ -1566,7 +2764,7 @@ RCT_REMAP_METHOD(getThetaState,
|
|
|
1566
2764
|
@"cameraError": state.cameraError != nil ? cameraErrorList : [NSNull null],
|
|
1567
2765
|
@"isBatteryInsert": state.isBatteryInsert != nil ? @([state.isBatteryInsert boolValue]) : [NSNull null]});
|
|
1568
2766
|
} else {
|
|
1569
|
-
reject(
|
|
2767
|
+
reject(ERROR_CODE_ERROR, @"no state", nil);
|
|
1570
2768
|
}
|
|
1571
2769
|
}];
|
|
1572
2770
|
}
|
|
@@ -1576,6 +2774,7 @@ RCT_REMAP_METHOD(getThetaState,
|
|
|
1576
2774
|
* @param fileType file type to retrieve
|
|
1577
2775
|
* @param startPosition start position to retrieve
|
|
1578
2776
|
* @param entryCount count to retrieve
|
|
2777
|
+
* @param storage Desired storage
|
|
1579
2778
|
* @param resolve resolver for listFiles
|
|
1580
2779
|
* @param rejecter rejecter for listFiles
|
|
1581
2780
|
*/
|
|
@@ -1583,32 +2782,32 @@ RCT_REMAP_METHOD(listFiles,
|
|
|
1583
2782
|
listFilesWithFileTypeEnum:(NSString*)fileType
|
|
1584
2783
|
withStartPosition:(int32_t)startPosition
|
|
1585
2784
|
withEntryCount:(int32_t)entryCount
|
|
2785
|
+
withStorage:(NSString*)storage
|
|
1586
2786
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1587
2787
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1588
2788
|
{
|
|
2789
|
+
if (!_theta) {
|
|
2790
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2791
|
+
return;
|
|
2792
|
+
}
|
|
1589
2793
|
[_theta listFilesFileType:[FileTypeEnum.toTheta objectForKey:fileType]
|
|
1590
2794
|
startPosition:startPosition
|
|
1591
2795
|
entryCount:entryCount
|
|
2796
|
+
storage:[StorageEnum.toTheta objectForKey:storage]
|
|
1592
2797
|
completionHandler:^(THETACThetaRepositoryThetaFiles *items,
|
|
1593
2798
|
NSError *error) {
|
|
1594
2799
|
if (error) {
|
|
1595
|
-
reject(
|
|
2800
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1596
2801
|
} else if (items) {
|
|
1597
2802
|
NSMutableArray *ary = [[NSMutableArray alloc] init];
|
|
1598
2803
|
for (int i = 0; i < items.fileList.count; i++) {
|
|
1599
2804
|
THETACThetaRepositoryFileInfo *finfo = items.fileList[i];
|
|
1600
|
-
[ary addObject:
|
|
1601
|
-
@"name":finfo.name,
|
|
1602
|
-
@"size":@(finfo.size),
|
|
1603
|
-
@"dateTime":finfo.dateTime,
|
|
1604
|
-
@"thumbnailUrl":finfo.thumbnailUrl,
|
|
1605
|
-
@"fileUrl":finfo.fileUrl
|
|
1606
|
-
}];
|
|
2805
|
+
[ary addObject:fileInfoFromTheta(finfo)];
|
|
1607
2806
|
}
|
|
1608
|
-
|
|
1609
|
-
|
|
2807
|
+
resolve(@{@"fileList":ary,
|
|
2808
|
+
@"totalEntries": @(items.totalEntries)});
|
|
1610
2809
|
} else {
|
|
1611
|
-
reject(
|
|
2810
|
+
reject(ERROR_CODE_ERROR, @"no items", nil);
|
|
1612
2811
|
}
|
|
1613
2812
|
}];
|
|
1614
2813
|
}
|
|
@@ -1624,9 +2823,13 @@ RCT_REMAP_METHOD(deleteFiles,
|
|
|
1624
2823
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1625
2824
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1626
2825
|
{
|
|
2826
|
+
if (!_theta) {
|
|
2827
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2828
|
+
return;
|
|
2829
|
+
}
|
|
1627
2830
|
[_theta deleteFilesFileUrls:fileUrls completionHandler:^(NSError *error) {
|
|
1628
2831
|
if (error) {
|
|
1629
|
-
reject(
|
|
2832
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1630
2833
|
} else {
|
|
1631
2834
|
resolve(@(YES));
|
|
1632
2835
|
}
|
|
@@ -1642,9 +2845,13 @@ RCT_REMAP_METHOD(deleteAllFiles,
|
|
|
1642
2845
|
deleteAllFilesWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1643
2846
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1644
2847
|
{
|
|
2848
|
+
if (!_theta) {
|
|
2849
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2850
|
+
return;
|
|
2851
|
+
}
|
|
1645
2852
|
[_theta deleteAllFilesWithCompletionHandler:^(NSError *error) {
|
|
1646
2853
|
if (error) {
|
|
1647
|
-
reject(
|
|
2854
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1648
2855
|
} else {
|
|
1649
2856
|
resolve(@(YES));
|
|
1650
2857
|
}
|
|
@@ -1660,9 +2867,13 @@ RCT_REMAP_METHOD(deleteAllImageFiles,
|
|
|
1660
2867
|
deleteAllImageFilesWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1661
2868
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1662
2869
|
{
|
|
2870
|
+
if (!_theta) {
|
|
2871
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2872
|
+
return;
|
|
2873
|
+
}
|
|
1663
2874
|
[_theta deleteAllImageFilesWithCompletionHandler:^(NSError *error) {
|
|
1664
2875
|
if (error) {
|
|
1665
|
-
reject(
|
|
2876
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1666
2877
|
return;
|
|
1667
2878
|
}
|
|
1668
2879
|
resolve(@(YES));
|
|
@@ -1678,9 +2889,13 @@ RCT_REMAP_METHOD(deleteAllVideoFiles,
|
|
|
1678
2889
|
deleteAllVideoFilesWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1679
2890
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1680
2891
|
{
|
|
2892
|
+
if (!_theta) {
|
|
2893
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2894
|
+
return;
|
|
2895
|
+
}
|
|
1681
2896
|
[_theta deleteAllVideoFilesWithCompletionHandler:^(NSError *error) {
|
|
1682
2897
|
if (error) {
|
|
1683
|
-
reject(
|
|
2898
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1684
2899
|
} else {
|
|
1685
2900
|
resolve(@(YES));
|
|
1686
2901
|
}
|
|
@@ -1698,6 +2913,10 @@ RCT_REMAP_METHOD(getOptions,
|
|
|
1698
2913
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1699
2914
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1700
2915
|
{
|
|
2916
|
+
if (!_theta) {
|
|
2917
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2918
|
+
return;
|
|
2919
|
+
}
|
|
1701
2920
|
NSMutableArray *optionNameList = [[NSMutableArray alloc] init];
|
|
1702
2921
|
for (id name in optionNames) {
|
|
1703
2922
|
[optionNameList addObject:[NameToOptionEnum objectForKey:name]];
|
|
@@ -1705,7 +2924,7 @@ RCT_REMAP_METHOD(getOptions,
|
|
|
1705
2924
|
[_theta getOptionsOptionNames:optionNameList
|
|
1706
2925
|
completionHandler:^(THETACThetaRepositoryOptions *options, NSError *error) {
|
|
1707
2926
|
if (error) {
|
|
1708
|
-
reject(
|
|
2927
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1709
2928
|
} else if (options) {
|
|
1710
2929
|
NSMutableDictionary *results = [[NSMutableDictionary alloc] init];
|
|
1711
2930
|
for (id name in optionNames) {
|
|
@@ -1717,7 +2936,7 @@ RCT_REMAP_METHOD(getOptions,
|
|
|
1717
2936
|
}
|
|
1718
2937
|
resolve(results);
|
|
1719
2938
|
} else {
|
|
1720
|
-
reject(
|
|
2939
|
+
reject(ERROR_CODE_ERROR, @"no options", nil);
|
|
1721
2940
|
}
|
|
1722
2941
|
}];
|
|
1723
2942
|
}
|
|
@@ -1733,6 +2952,10 @@ RCT_REMAP_METHOD(setOptions,
|
|
|
1733
2952
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1734
2953
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1735
2954
|
{
|
|
2955
|
+
if (!_theta) {
|
|
2956
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
1736
2959
|
THETACThetaRepositoryOptions *newoptions = [[THETACThetaRepositoryOptions alloc] init];
|
|
1737
2960
|
for (id option in [options allKeys]) {
|
|
1738
2961
|
OptionConverter converter = [NameToConverter objectForKey:option];
|
|
@@ -1745,7 +2968,7 @@ RCT_REMAP_METHOD(setOptions,
|
|
|
1745
2968
|
}
|
|
1746
2969
|
[_theta setOptionsOptions:newoptions completionHandler:^(NSError *error) {
|
|
1747
2970
|
if (error) {
|
|
1748
|
-
reject(
|
|
2971
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1749
2972
|
} else {
|
|
1750
2973
|
resolve(@(YES));
|
|
1751
2974
|
}
|
|
@@ -1783,6 +3006,10 @@ RCT_REMAP_METHOD(getLivePreview,
|
|
|
1783
3006
|
getLivePreviewWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1784
3007
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1785
3008
|
{
|
|
3009
|
+
if (!_theta) {
|
|
3010
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
1786
3013
|
FrameHandler *_frameHandler =
|
|
1787
3014
|
[[FrameHandler alloc] initWith:self withEvent:^(NSData *data) {
|
|
1788
3015
|
if (self->hasListeners) {
|
|
@@ -1795,7 +3022,7 @@ RCT_REMAP_METHOD(getLivePreview,
|
|
|
1795
3022
|
self.previewing = YES;
|
|
1796
3023
|
[_theta getLivePreviewFrameHandler:_frameHandler completionHandler:^(NSError *error) {
|
|
1797
3024
|
if (error) {
|
|
1798
|
-
reject(
|
|
3025
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1799
3026
|
} else {
|
|
1800
3027
|
resolve(@(YES));
|
|
1801
3028
|
}
|
|
@@ -1817,6 +3044,10 @@ RCT_REMAP_METHOD(stopLivePreview,
|
|
|
1817
3044
|
RCT_REMAP_METHOD(getPhotoCaptureBuilder,
|
|
1818
3045
|
getPhotoCaptureBuilder)
|
|
1819
3046
|
{
|
|
3047
|
+
if (!_theta) {
|
|
3048
|
+
[NSException raise:ERROR_CODE_ERROR format:MESSAGE_NOT_INIT];
|
|
3049
|
+
return;
|
|
3050
|
+
}
|
|
1820
3051
|
self.photoCaptureBuilder = [_theta getPhotoCaptureBuilder];
|
|
1821
3052
|
}
|
|
1822
3053
|
|
|
@@ -1831,8 +3062,12 @@ RCT_REMAP_METHOD(buildPhotoCapture,
|
|
|
1831
3062
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1832
3063
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1833
3064
|
{
|
|
3065
|
+
if (!_theta) {
|
|
3066
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3067
|
+
return;
|
|
3068
|
+
}
|
|
1834
3069
|
if (!self.photoCaptureBuilder) {
|
|
1835
|
-
reject(
|
|
3070
|
+
reject(ERROR_CODE_ERROR, @"no photo capture pbuilder", nil);
|
|
1836
3071
|
return;
|
|
1837
3072
|
}
|
|
1838
3073
|
for (id photoOption in [options allKeys]) {
|
|
@@ -1844,7 +3079,7 @@ RCT_REMAP_METHOD(buildPhotoCapture,
|
|
|
1844
3079
|
[self.photoCaptureBuilder
|
|
1845
3080
|
buildWithCompletionHandler:^(THETACPhotoCapture *photoCapture, NSError *error) {
|
|
1846
3081
|
if (error) {
|
|
1847
|
-
reject(
|
|
3082
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1848
3083
|
return;
|
|
1849
3084
|
}
|
|
1850
3085
|
if (photoCapture) {
|
|
@@ -1852,7 +3087,7 @@ RCT_REMAP_METHOD(buildPhotoCapture,
|
|
|
1852
3087
|
self.photoCaptureBuilder = nil;
|
|
1853
3088
|
resolve(@(YES));
|
|
1854
3089
|
} else {
|
|
1855
|
-
reject(
|
|
3090
|
+
reject(ERROR_CODE_ERROR, @"no photoCapture", nil);
|
|
1856
3091
|
}
|
|
1857
3092
|
}];
|
|
1858
3093
|
}
|
|
@@ -1866,8 +3101,12 @@ RCT_REMAP_METHOD(takePicture,
|
|
|
1866
3101
|
takePictureWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1867
3102
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1868
3103
|
{
|
|
3104
|
+
if (!_theta) {
|
|
3105
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3106
|
+
return;
|
|
3107
|
+
}
|
|
1869
3108
|
if (!self.photoCapture) {
|
|
1870
|
-
reject(
|
|
3109
|
+
reject(ERROR_CODE_ERROR, @"no photoCapture", nil);
|
|
1871
3110
|
return;
|
|
1872
3111
|
}
|
|
1873
3112
|
PhotoCallback *callback = [[PhotoCallback alloc] initWith:self
|
|
@@ -1876,12 +3115,126 @@ RCT_REMAP_METHOD(takePicture,
|
|
|
1876
3115
|
[self.photoCapture takePictureCallback:callback];
|
|
1877
3116
|
}
|
|
1878
3117
|
|
|
3118
|
+
/**
|
|
3119
|
+
* getTimeShiftCaptureBuilder - get time-shift builder from repository
|
|
3120
|
+
*/
|
|
3121
|
+
RCT_REMAP_METHOD(getTimeShiftCaptureBuilder,
|
|
3122
|
+
getTimeShiftCaptureBuilder)
|
|
3123
|
+
{
|
|
3124
|
+
if (!_theta) {
|
|
3125
|
+
[NSException raise:ERROR_CODE_ERROR format:MESSAGE_NOT_INIT];
|
|
3126
|
+
return;
|
|
3127
|
+
}
|
|
3128
|
+
self.timeShiftCaptureBuilder = [_theta getTimeShiftCaptureBuilder];
|
|
3129
|
+
}
|
|
3130
|
+
|
|
3131
|
+
/**
|
|
3132
|
+
* buildTimeShiftCapture - build time-shift capture
|
|
3133
|
+
* @param options option to execute time-shift
|
|
3134
|
+
* @param interval interval of checking time-shift status
|
|
3135
|
+
* @param resolve resolver for buildTimeShiftCapture
|
|
3136
|
+
* @param rejecter rejecter for buildTimeShiftCapture
|
|
3137
|
+
*/
|
|
3138
|
+
RCT_REMAP_METHOD(buildTimeShiftCapture,
|
|
3139
|
+
buildTimeShiftCaptureWithOptions:(NSDictionary*)options
|
|
3140
|
+
withInterval:(int)interval
|
|
3141
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
3142
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
3143
|
+
{
|
|
3144
|
+
if (!_theta) {
|
|
3145
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3146
|
+
return;
|
|
3147
|
+
}
|
|
3148
|
+
if (!self.timeShiftCaptureBuilder) {
|
|
3149
|
+
reject(@"error", @"no time-shift capture pbuilder", nil);
|
|
3150
|
+
return;
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
for (id option in [options allKeys]) {
|
|
3154
|
+
convert_t *convert = [NameToConverter objectForKey:option]();
|
|
3155
|
+
if (convert && convert->setTimeShiftOption) {
|
|
3156
|
+
convert->setTimeShiftOption(options, self.timeShiftCaptureBuilder);
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
if (interval >= 0) {
|
|
3161
|
+
[self.timeShiftCaptureBuilder setCheckStatusCommandIntervalTimeMillis: (int64_t)interval];
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
[self.timeShiftCaptureBuilder buildWithCompletionHandler:^(THETACTimeShiftCapture *timeShiftCapture, NSError *error) {
|
|
3165
|
+
if (error) {
|
|
3166
|
+
reject(@"error", [error localizedDescription], error);
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
if (timeShiftCapture) {
|
|
3170
|
+
self.timeShiftCapture = timeShiftCapture;
|
|
3171
|
+
self.timeShiftCaptureBuilder = nil;
|
|
3172
|
+
resolve(@(YES));
|
|
3173
|
+
} else {
|
|
3174
|
+
reject(@"error", @"no timeShiftCapture", nil);
|
|
3175
|
+
}
|
|
3176
|
+
}];
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
/**
|
|
3180
|
+
* startTimeShiftCapture - start time-shift
|
|
3181
|
+
* @param resolve resolver for startTimeShiftCapture
|
|
3182
|
+
* @param rejecter rejecter for startTimeShiftCapture
|
|
3183
|
+
*/
|
|
3184
|
+
RCT_REMAP_METHOD(startTimeShiftCapture,
|
|
3185
|
+
startTimeShiftCaptureWithResolver:(RCTPromiseResolveBlock)resolve
|
|
3186
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
3187
|
+
{
|
|
3188
|
+
if (!_theta) {
|
|
3189
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
if (!self.timeShiftCapture) {
|
|
3193
|
+
reject(@"error", @"no timeShiftCapture", nil);
|
|
3194
|
+
return;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
TimeShiftStartCallback *callback = [[TimeShiftStartCallback alloc] initWith:self
|
|
3198
|
+
withProgress:^(float completion) {
|
|
3199
|
+
[self sendEventWithName:EVENT_NOTIFY
|
|
3200
|
+
body:toCaptureProgressNotifyParam([NSNumber numberWithFloat:completion])];
|
|
3201
|
+
}
|
|
3202
|
+
withResolver:resolve
|
|
3203
|
+
withRejecter:reject];
|
|
3204
|
+
self.timeShiftCapturing = [self.timeShiftCapture startCaptureCallback:callback];
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3207
|
+
/**
|
|
3208
|
+
* cancelTimeShiftCapture - stop time-shift
|
|
3209
|
+
* @param resolve resolver for stopTimeShiftCapture
|
|
3210
|
+
* @param rejecter rejecter for stopTimeShiftCapture
|
|
3211
|
+
*/
|
|
3212
|
+
RCT_REMAP_METHOD(cancelTimeShiftCapture,
|
|
3213
|
+
cancelTimeShiftCaptureWithResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
3214
|
+
{
|
|
3215
|
+
if (!_theta) {
|
|
3216
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3217
|
+
return;
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
if (!self.timeShiftCapturing) {
|
|
3221
|
+
reject(@"error", @"no timeShiftCapturing", nil);
|
|
3222
|
+
return;
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
[self.timeShiftCapturing cancelCapture];
|
|
3226
|
+
}
|
|
3227
|
+
|
|
1879
3228
|
/**
|
|
1880
3229
|
* getVideoCaptureBuilder - get video capture builder
|
|
1881
3230
|
*/
|
|
1882
3231
|
RCT_REMAP_METHOD(getVideoCaptureBuilder,
|
|
1883
3232
|
getVideoCaptureBuilder)
|
|
1884
3233
|
{
|
|
3234
|
+
if (!_theta) {
|
|
3235
|
+
[NSException raise:ERROR_CODE_ERROR format:MESSAGE_NOT_INIT];
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
1885
3238
|
self.videoCaptureBuilder = [_theta getVideoCaptureBuilder];
|
|
1886
3239
|
}
|
|
1887
3240
|
|
|
@@ -1896,8 +3249,12 @@ RCT_REMAP_METHOD(buildVideoCapture,
|
|
|
1896
3249
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1897
3250
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1898
3251
|
{
|
|
3252
|
+
if (!_theta) {
|
|
3253
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3254
|
+
return;
|
|
3255
|
+
}
|
|
1899
3256
|
if (!self.videoCaptureBuilder) {
|
|
1900
|
-
reject(
|
|
3257
|
+
reject(ERROR_CODE_ERROR, @"no video capture builder", nil);
|
|
1901
3258
|
return;
|
|
1902
3259
|
}
|
|
1903
3260
|
for (id videoOption in [options allKeys]) {
|
|
@@ -1909,7 +3266,7 @@ RCT_REMAP_METHOD(buildVideoCapture,
|
|
|
1909
3266
|
[self.videoCaptureBuilder
|
|
1910
3267
|
buildWithCompletionHandler:^(THETACVideoCapture *videoCapture, NSError *error) {
|
|
1911
3268
|
if (error) {
|
|
1912
|
-
reject(
|
|
3269
|
+
reject(ERROR_CODE_ERROR, @"videoCapture build failed", error);
|
|
1913
3270
|
return;
|
|
1914
3271
|
}
|
|
1915
3272
|
if (videoCapture) {
|
|
@@ -1917,7 +3274,7 @@ RCT_REMAP_METHOD(buildVideoCapture,
|
|
|
1917
3274
|
self.videoCaptureBuilder = nil;
|
|
1918
3275
|
resolve(@(YES));
|
|
1919
3276
|
} else {
|
|
1920
|
-
reject(
|
|
3277
|
+
reject(ERROR_CODE_ERROR, @"no videoCapture", nil);
|
|
1921
3278
|
}
|
|
1922
3279
|
}];
|
|
1923
3280
|
}
|
|
@@ -1931,8 +3288,12 @@ RCT_REMAP_METHOD(startCapture,
|
|
|
1931
3288
|
startCaptureWithResolver:(RCTPromiseResolveBlock)resolve
|
|
1932
3289
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1933
3290
|
{
|
|
3291
|
+
if (!_theta) {
|
|
3292
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3293
|
+
return;
|
|
3294
|
+
}
|
|
1934
3295
|
if (!self.videoCapture) {
|
|
1935
|
-
reject(
|
|
3296
|
+
reject(ERROR_CODE_ERROR, @"no videoCapture", nil);
|
|
1936
3297
|
return;
|
|
1937
3298
|
}
|
|
1938
3299
|
VideoCallback *callback = [[VideoCallback alloc] initWith:self
|
|
@@ -1947,6 +3308,10 @@ RCT_REMAP_METHOD(startCapture,
|
|
|
1947
3308
|
RCT_REMAP_METHOD(stopCapture,
|
|
1948
3309
|
stopCapture)
|
|
1949
3310
|
{
|
|
3311
|
+
if (!_theta) {
|
|
3312
|
+
[NSException raise:ERROR_CODE_ERROR format:MESSAGE_NOT_INIT];
|
|
3313
|
+
return;
|
|
3314
|
+
}
|
|
1950
3315
|
if (!self.videoCapturing) {
|
|
1951
3316
|
// todo warning
|
|
1952
3317
|
return;
|
|
@@ -1964,12 +3329,16 @@ RCT_REMAP_METHOD(getMetadata,
|
|
|
1964
3329
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
1965
3330
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
1966
3331
|
{
|
|
3332
|
+
if (!_theta) {
|
|
3333
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3334
|
+
return;
|
|
3335
|
+
}
|
|
1967
3336
|
[_theta getMetadataFileUrl:fileUrl
|
|
1968
3337
|
completionHandler:^(THETACKotlinPair<THETACThetaRepositoryExif *,
|
|
1969
3338
|
THETACThetaRepositoryXmp *> *metaData,
|
|
1970
3339
|
NSError *error) {
|
|
1971
3340
|
if (error) {
|
|
1972
|
-
reject(
|
|
3341
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
1973
3342
|
} else if (metaData) {
|
|
1974
3343
|
NSDictionary* exif = nil;
|
|
1975
3344
|
NSDictionary* xmp = nil;
|
|
@@ -1992,7 +3361,7 @@ RCT_REMAP_METHOD(getMetadata,
|
|
|
1992
3361
|
}
|
|
1993
3362
|
resolve(@{@"exif": exif, @"xmp": xmp});
|
|
1994
3363
|
} else {
|
|
1995
|
-
reject(
|
|
3364
|
+
reject(ERROR_CODE_ERROR, @"no metaData", nil);
|
|
1996
3365
|
}
|
|
1997
3366
|
}];
|
|
1998
3367
|
}
|
|
@@ -2006,9 +3375,13 @@ RCT_REMAP_METHOD(reset,
|
|
|
2006
3375
|
resetWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2007
3376
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2008
3377
|
{
|
|
3378
|
+
if (!_theta) {
|
|
3379
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
2009
3382
|
[_theta resetWithCompletionHandler:^(NSError *error) {
|
|
2010
3383
|
if (error) {
|
|
2011
|
-
reject(
|
|
3384
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2012
3385
|
} else {
|
|
2013
3386
|
resolve(@(YES));
|
|
2014
3387
|
}
|
|
@@ -2024,9 +3397,13 @@ RCT_REMAP_METHOD(restoreSettings,
|
|
|
2024
3397
|
restoreSettingsWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2025
3398
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2026
3399
|
{
|
|
3400
|
+
if (!_theta) {
|
|
3401
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3402
|
+
return;
|
|
3403
|
+
}
|
|
2027
3404
|
[_theta restoreSettingsWithCompletionHandler:^(NSError *error) {
|
|
2028
3405
|
if (error) {
|
|
2029
|
-
reject(
|
|
3406
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2030
3407
|
} else {
|
|
2031
3408
|
resolve(@(YES));
|
|
2032
3409
|
}
|
|
@@ -2042,9 +3419,13 @@ RCT_REMAP_METHOD(stopSelfTimer,
|
|
|
2042
3419
|
stopSelfTimerWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2043
3420
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2044
3421
|
{
|
|
3422
|
+
if (!_theta) {
|
|
3423
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
2045
3426
|
[_theta stopSelfTimerWithCompletionHandler:^(NSError *error) {
|
|
2046
3427
|
if (error) {
|
|
2047
|
-
reject(
|
|
3428
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2048
3429
|
} else {
|
|
2049
3430
|
resolve(@(YES));
|
|
2050
3431
|
}
|
|
@@ -2066,16 +3447,20 @@ RCT_REMAP_METHOD(convertVideoFormats,
|
|
|
2066
3447
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2067
3448
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2068
3449
|
{
|
|
3450
|
+
if (!_theta) {
|
|
3451
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3452
|
+
return;
|
|
3453
|
+
}
|
|
2069
3454
|
[_theta convertVideoFormatsFileUrl:fileUrl
|
|
2070
3455
|
toLowResolution:toLowResolution
|
|
2071
3456
|
applyTopBottomCorrection:applyTopBottomCorrection
|
|
2072
3457
|
completionHandler:^(NSString *convertedUrl, NSError *error) {
|
|
2073
3458
|
if (error) {
|
|
2074
|
-
reject(
|
|
3459
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2075
3460
|
} else if (convertedUrl) {
|
|
2076
3461
|
resolve(convertedUrl);
|
|
2077
3462
|
} else {
|
|
2078
|
-
reject(
|
|
3463
|
+
reject(ERROR_CODE_ERROR, @"no convertVideo", nil);
|
|
2079
3464
|
}
|
|
2080
3465
|
}];
|
|
2081
3466
|
}
|
|
@@ -2089,9 +3474,13 @@ RCT_REMAP_METHOD(cancelVideoConvert,
|
|
|
2089
3474
|
cancelVideoConvertWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2090
3475
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2091
3476
|
{
|
|
3477
|
+
if (!_theta) {
|
|
3478
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
2092
3481
|
[_theta cancelVideoConvertWithCompletionHandler:^(NSError *error) {
|
|
2093
3482
|
if (error) {
|
|
2094
|
-
reject(
|
|
3483
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2095
3484
|
} else {
|
|
2096
3485
|
resolve(@(YES));
|
|
2097
3486
|
}
|
|
@@ -2107,9 +3496,13 @@ RCT_REMAP_METHOD(finishWlan,
|
|
|
2107
3496
|
finishWlanWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2108
3497
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2109
3498
|
{
|
|
3499
|
+
if (!_theta) {
|
|
3500
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3501
|
+
return;
|
|
3502
|
+
}
|
|
2110
3503
|
[_theta finishWlanWithCompletionHandler:^(NSError *error) {
|
|
2111
3504
|
if (error) {
|
|
2112
|
-
reject(
|
|
3505
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2113
3506
|
} else {
|
|
2114
3507
|
resolve(@(YES));
|
|
2115
3508
|
}
|
|
@@ -2125,28 +3518,50 @@ RCT_REMAP_METHOD(listAccessPoints,
|
|
|
2125
3518
|
listAccessPointsWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2126
3519
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2127
3520
|
{
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
3521
|
+
if (!_theta) {
|
|
3522
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3523
|
+
return;
|
|
3524
|
+
}
|
|
3525
|
+
[_theta listAccessPointsWithCompletionHandler:^(NSArray *accessPointList, NSError *error) {
|
|
3526
|
+
if (error) {
|
|
3527
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
3528
|
+
} else if (accessPointList) {
|
|
3529
|
+
NSMutableArray *ary = [[NSMutableArray alloc] init];
|
|
3530
|
+
for (int i = 0; i < accessPointList.count; i++) {
|
|
3531
|
+
THETACThetaRepositoryAccessPoint *apinfo = accessPointList[i];
|
|
3532
|
+
|
|
3533
|
+
NSMutableDictionary *optionsDic = [[NSMutableDictionary alloc] init];
|
|
3534
|
+
convert_t *convert = &ProxyCvt;
|
|
3535
|
+
if (convert->setFromTheta) {
|
|
3536
|
+
THETACThetaRepositoryOptions *options = [[THETACThetaRepositoryOptions alloc] init];
|
|
3537
|
+
[options setProxy:apinfo.proxy];
|
|
3538
|
+
convert->setFromTheta(optionsDic, options);
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
NSMutableDictionary *item = [[NSMutableDictionary alloc] init];
|
|
3542
|
+
[item setObject:apinfo.ssid forKey:@"ssid"];
|
|
3543
|
+
[item setObject:@(apinfo.ssidStealth) forKey:@"ssidStealth"];
|
|
3544
|
+
[item setObject:[AuthModeEnum.fromTheta objectForKey:apinfo.authMode]forKey:@"authMode"];
|
|
3545
|
+
[item setObject:@(apinfo.connectionPriority) forKey:@"connectionPriority"];
|
|
3546
|
+
[item setObject:@(apinfo.usingDhcp) forKey:@"usingDhcp"];
|
|
3547
|
+
if (apinfo.ipAddress) {
|
|
3548
|
+
[item setObject:apinfo.ipAddress forKey:@"ipAddress"];
|
|
3549
|
+
}
|
|
3550
|
+
if (apinfo.subnetMask) {
|
|
3551
|
+
[item setObject:apinfo.subnetMask forKey:@"subnetMask"];
|
|
3552
|
+
}
|
|
3553
|
+
if (apinfo.defaultGateway) {
|
|
3554
|
+
[item setObject:apinfo.defaultGateway forKey:@"defaultGateway"];
|
|
3555
|
+
}
|
|
3556
|
+
if ([optionsDic objectForKey:@"proxy"]) {
|
|
3557
|
+
[item setObject:[optionsDic objectForKey:@"proxy"] forKey:@"proxy"];
|
|
3558
|
+
}
|
|
3559
|
+
[ary addObject:item];
|
|
3560
|
+
}
|
|
3561
|
+
resolve(ary);
|
|
3562
|
+
} else {
|
|
3563
|
+
reject(ERROR_CODE_ERROR, @"no access point", nil);
|
|
3564
|
+
}
|
|
2150
3565
|
}];
|
|
2151
3566
|
}
|
|
2152
3567
|
|
|
@@ -2157,6 +3572,7 @@ RCT_REMAP_METHOD(listAccessPoints,
|
|
|
2157
3572
|
* @param authMode auth mode to connect
|
|
2158
3573
|
* @param password password to connect with auth
|
|
2159
3574
|
* @param connectionPriority connection priority
|
|
3575
|
+
* @param proxy Proxy information to be used for the access point.
|
|
2160
3576
|
* @param resolve resolver for setAccessPointDynamically
|
|
2161
3577
|
* @param rejecter rejecter for setAccessPointDynamically
|
|
2162
3578
|
*/
|
|
@@ -2166,20 +3582,26 @@ RCT_REMAP_METHOD(setAccessPointDynamically,
|
|
|
2166
3582
|
withAuthMode:(NSString *)authMode
|
|
2167
3583
|
withPassword:(NSString *)password
|
|
2168
3584
|
withConnectionPrioryty:(int32_t)connectionPriority
|
|
3585
|
+
withProxy:(NSDictionary *)proxy
|
|
2169
3586
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2170
3587
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2171
3588
|
{
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
3589
|
+
if (!_theta) {
|
|
3590
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3591
|
+
return;
|
|
3592
|
+
}
|
|
3593
|
+
[_theta setAccessPointDynamicallySsid:ssid
|
|
3594
|
+
ssidStealth:ssidStealth
|
|
3595
|
+
authMode:[AuthModeEnum.toTheta objectForKey:authMode]
|
|
3596
|
+
password:password
|
|
3597
|
+
connectionPriority:connectionPriority
|
|
3598
|
+
proxy:convertDictionaryToProxy(proxy)
|
|
3599
|
+
completionHandler:^(NSError *error) {
|
|
3600
|
+
if (error) {
|
|
3601
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
3602
|
+
} else {
|
|
3603
|
+
resolve(@(YES));
|
|
3604
|
+
}
|
|
2183
3605
|
}];
|
|
2184
3606
|
}
|
|
2185
3607
|
|
|
@@ -2193,6 +3615,7 @@ RCT_REMAP_METHOD(setAccessPointDynamically,
|
|
|
2193
3615
|
* @param ipAddress static ipaddress to connect
|
|
2194
3616
|
* @param subnetMask subnet mask for ip address
|
|
2195
3617
|
* @param defaultGateway default gateway address
|
|
3618
|
+
* @param proxy Proxy information to be used for the access point.
|
|
2196
3619
|
* @param resolve resolver for setAccessPointStatically
|
|
2197
3620
|
* @param rejecter rejecter for setAccessPointStatically
|
|
2198
3621
|
*/
|
|
@@ -2205,23 +3628,29 @@ RCT_REMAP_METHOD(setAccessPointStatically,
|
|
|
2205
3628
|
withIpAddress:(NSString *)ipAddress
|
|
2206
3629
|
withSubnetMask:(NSString *)subnetMask
|
|
2207
3630
|
withDefaultGateway:(NSString *)defaultGateway
|
|
3631
|
+
withProxy:(NSDictionary *)proxy
|
|
2208
3632
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2209
3633
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2210
3634
|
{
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
3635
|
+
if (!_theta) {
|
|
3636
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3637
|
+
return;
|
|
3638
|
+
}
|
|
3639
|
+
[_theta setAccessPointStaticallySsid:ssid
|
|
3640
|
+
ssidStealth:ssidStealth
|
|
3641
|
+
authMode:[AuthModeEnum.toTheta objectForKey:authMode]
|
|
3642
|
+
password:password
|
|
3643
|
+
connectionPriority:connectionPriority
|
|
3644
|
+
ipAddress:ipAddress
|
|
3645
|
+
subnetMask:subnetMask
|
|
3646
|
+
defaultGateway:defaultGateway
|
|
3647
|
+
proxy:convertDictionaryToProxy(proxy)
|
|
3648
|
+
completionHandler:^(NSError *error) {
|
|
3649
|
+
if (error) {
|
|
3650
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
3651
|
+
} else {
|
|
3652
|
+
resolve(@(YES));
|
|
3653
|
+
}
|
|
2225
3654
|
}];
|
|
2226
3655
|
}
|
|
2227
3656
|
|
|
@@ -2236,16 +3665,33 @@ RCT_REMAP_METHOD(deleteAccessPoint,
|
|
|
2236
3665
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2237
3666
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2238
3667
|
{
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
3668
|
+
if (!_theta) {
|
|
3669
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3670
|
+
return;
|
|
3671
|
+
}
|
|
3672
|
+
[_theta deleteAccessPointSsid:ssid
|
|
3673
|
+
completionHandler:^(NSError *error) {
|
|
3674
|
+
if (error) {
|
|
3675
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
3676
|
+
} else {
|
|
3677
|
+
resolve(@(YES));
|
|
3678
|
+
}
|
|
2246
3679
|
}];
|
|
2247
3680
|
}
|
|
2248
3681
|
|
|
3682
|
+
/// convert NSDictionary to THETACThetaRepositoryProxy
|
|
3683
|
+
/// @param proxyDic NSDictionary of proxy
|
|
3684
|
+
static THETACThetaRepositoryProxy* convertDictionaryToProxy(NSDictionary *proxyDic) {
|
|
3685
|
+
THETACThetaRepositoryOptions *options = [[THETACThetaRepositoryOptions alloc] init];
|
|
3686
|
+
convert_t *convert = &ProxyCvt;
|
|
3687
|
+
if (convert->setToTheta) {
|
|
3688
|
+
NSMutableDictionary *optionsDic = [[NSMutableDictionary alloc] init];
|
|
3689
|
+
[optionsDic setObject:proxyDic forKey:@"proxy"];
|
|
3690
|
+
convert->setToTheta(optionsDic, options);
|
|
3691
|
+
}
|
|
3692
|
+
return options.proxy;
|
|
3693
|
+
}
|
|
3694
|
+
|
|
2249
3695
|
/**
|
|
2250
3696
|
* convertOptionsFromTheta - convert resposnse of getMySetting
|
|
2251
3697
|
* @param results conversion results
|
|
@@ -2284,19 +3730,23 @@ RCT_REMAP_METHOD(getMySetting,
|
|
|
2284
3730
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2285
3731
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2286
3732
|
{
|
|
3733
|
+
if (!_theta) {
|
|
3734
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3735
|
+
return;
|
|
3736
|
+
}
|
|
2287
3737
|
[_theta getMySettingCaptureMode:[CaptureModeEnum.toTheta objectForKey:captureMode]
|
|
2288
3738
|
completionHandler:^(THETACThetaRepositoryOptions *options, NSError *error) {
|
|
2289
3739
|
if (error) {
|
|
2290
|
-
reject(
|
|
3740
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2291
3741
|
} else if (options) {
|
|
2292
3742
|
NSMutableDictionary *results = [[NSMutableDictionary alloc] init];
|
|
2293
3743
|
NSError *convertError = convertOptionsFromTheta(results, options);
|
|
2294
3744
|
if (convertError) {
|
|
2295
|
-
reject(
|
|
3745
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], convertError);
|
|
2296
3746
|
}
|
|
2297
3747
|
resolve(results);
|
|
2298
3748
|
} else {
|
|
2299
|
-
reject(
|
|
3749
|
+
reject(ERROR_CODE_ERROR, @"no options", nil);
|
|
2300
3750
|
}
|
|
2301
3751
|
}];
|
|
2302
3752
|
}
|
|
@@ -2312,6 +3762,10 @@ RCT_REMAP_METHOD(getMySettingFromOldModel,
|
|
|
2312
3762
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2313
3763
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2314
3764
|
{
|
|
3765
|
+
if (!_theta) {
|
|
3766
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3767
|
+
return;
|
|
3768
|
+
}
|
|
2315
3769
|
NSMutableArray *optionNameList = [[NSMutableArray alloc] init];
|
|
2316
3770
|
for (id name in optionNames) {
|
|
2317
3771
|
[optionNameList addObject:[NameToOptionEnum objectForKey:name]];
|
|
@@ -2319,7 +3773,7 @@ RCT_REMAP_METHOD(getMySettingFromOldModel,
|
|
|
2319
3773
|
[_theta getMySettingOptionNames:optionNameList
|
|
2320
3774
|
completionHandler:^(THETACThetaRepositoryOptions *options, NSError *error) {
|
|
2321
3775
|
if (error) {
|
|
2322
|
-
reject(
|
|
3776
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2323
3777
|
} else if (options) {
|
|
2324
3778
|
NSMutableDictionary *results = [[NSMutableDictionary alloc] init];
|
|
2325
3779
|
for (id name in optionNames) {
|
|
@@ -2334,7 +3788,7 @@ RCT_REMAP_METHOD(getMySettingFromOldModel,
|
|
|
2334
3788
|
}
|
|
2335
3789
|
resolve(results);
|
|
2336
3790
|
} else {
|
|
2337
|
-
reject(
|
|
3791
|
+
reject(ERROR_CODE_ERROR, @"no options", nil);
|
|
2338
3792
|
}
|
|
2339
3793
|
}];
|
|
2340
3794
|
}
|
|
@@ -2352,6 +3806,10 @@ RCT_REMAP_METHOD(setMySetting,
|
|
|
2352
3806
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2353
3807
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2354
3808
|
{
|
|
3809
|
+
if (!_theta) {
|
|
3810
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3811
|
+
return;
|
|
3812
|
+
}
|
|
2355
3813
|
THETACThetaRepositoryOptions *newoptions = [[THETACThetaRepositoryOptions alloc] init];
|
|
2356
3814
|
for (id option in [options allKeys]) {
|
|
2357
3815
|
OptionConverter converter = [NameToConverter objectForKey:option];
|
|
@@ -2366,7 +3824,7 @@ RCT_REMAP_METHOD(setMySetting,
|
|
|
2366
3824
|
options:newoptions
|
|
2367
3825
|
completionHandler:^(NSError *error) {
|
|
2368
3826
|
if (error) {
|
|
2369
|
-
reject(
|
|
3827
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2370
3828
|
} else {
|
|
2371
3829
|
resolve(@(YES));
|
|
2372
3830
|
}
|
|
@@ -2384,10 +3842,14 @@ RCT_REMAP_METHOD(deleteMySetting,
|
|
|
2384
3842
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2385
3843
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2386
3844
|
{
|
|
3845
|
+
if (!_theta) {
|
|
3846
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3847
|
+
return;
|
|
3848
|
+
}
|
|
2387
3849
|
[_theta deleteMySettingCaptureMode:[CaptureModeEnum.toTheta objectForKey:captureMode]
|
|
2388
3850
|
completionHandler:^(NSError *error) {
|
|
2389
3851
|
if (error) {
|
|
2390
|
-
reject(
|
|
3852
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2391
3853
|
} else {
|
|
2392
3854
|
resolve(@(YES));
|
|
2393
3855
|
}
|
|
@@ -2403,9 +3865,13 @@ RCT_REMAP_METHOD(listPlugins,
|
|
|
2403
3865
|
listPluginsWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2404
3866
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2405
3867
|
{
|
|
3868
|
+
if (!_theta) {
|
|
3869
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3870
|
+
return;
|
|
3871
|
+
}
|
|
2406
3872
|
[_theta listPluginsWithCompletionHandler:^(NSArray *pluginList, NSError *error) {
|
|
2407
3873
|
if (error) {
|
|
2408
|
-
reject(
|
|
3874
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2409
3875
|
} else if (pluginList) {
|
|
2410
3876
|
NSMutableArray *ary = [[NSMutableArray alloc] init];
|
|
2411
3877
|
for (int i = 0; i < pluginList.count; i++) {
|
|
@@ -2425,7 +3891,7 @@ RCT_REMAP_METHOD(listPlugins,
|
|
|
2425
3891
|
}
|
|
2426
3892
|
resolve(ary);
|
|
2427
3893
|
} else {
|
|
2428
|
-
reject(
|
|
3894
|
+
reject(ERROR_CODE_ERROR, @"no plugin", nil);
|
|
2429
3895
|
}
|
|
2430
3896
|
}];
|
|
2431
3897
|
}
|
|
@@ -2441,10 +3907,14 @@ RCT_REMAP_METHOD(setPlugin,
|
|
|
2441
3907
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2442
3908
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2443
3909
|
{
|
|
3910
|
+
if (!_theta) {
|
|
3911
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3912
|
+
return;
|
|
3913
|
+
}
|
|
2444
3914
|
[_theta setPluginPackageName:packageName
|
|
2445
3915
|
completionHandler:^(NSError *error) {
|
|
2446
3916
|
if (error) {
|
|
2447
|
-
reject(
|
|
3917
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2448
3918
|
} else {
|
|
2449
3919
|
resolve(@(YES));
|
|
2450
3920
|
}
|
|
@@ -2462,11 +3932,15 @@ RCT_REMAP_METHOD(startPlugin,
|
|
|
2462
3932
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2463
3933
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2464
3934
|
{
|
|
3935
|
+
if (!_theta) {
|
|
3936
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3937
|
+
return;
|
|
3938
|
+
}
|
|
2465
3939
|
[_theta startPluginPackageName:packageName
|
|
2466
3940
|
completionHandler:^(NSError *error) {
|
|
2467
3941
|
if (error) {
|
|
2468
|
-
reject(
|
|
2469
|
-
|
|
3942
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
3943
|
+
|
|
2470
3944
|
} else {
|
|
2471
3945
|
resolve(@(YES));
|
|
2472
3946
|
}
|
|
@@ -2482,10 +3956,14 @@ RCT_REMAP_METHOD(stopPlugin,
|
|
|
2482
3956
|
stopPluginWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2483
3957
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2484
3958
|
{
|
|
3959
|
+
if (!_theta) {
|
|
3960
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3961
|
+
return;
|
|
3962
|
+
}
|
|
2485
3963
|
[_theta stopPluginWithCompletionHandler:^(NSError *error) {
|
|
2486
3964
|
if (error) {
|
|
2487
|
-
reject(
|
|
2488
|
-
|
|
3965
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
3966
|
+
|
|
2489
3967
|
} else {
|
|
2490
3968
|
resolve(@(YES));
|
|
2491
3969
|
}
|
|
@@ -2503,15 +3981,19 @@ RCT_REMAP_METHOD(getPluginLicense,
|
|
|
2503
3981
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2504
3982
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2505
3983
|
{
|
|
3984
|
+
if (!_theta) {
|
|
3985
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
3986
|
+
return;
|
|
3987
|
+
}
|
|
2506
3988
|
[_theta getPluginLicensePackageName:packageName
|
|
2507
3989
|
completionHandler:^(NSString *pluginLicense, NSError *error) {
|
|
2508
3990
|
if (error) {
|
|
2509
|
-
reject(
|
|
2510
|
-
|
|
3991
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
3992
|
+
|
|
2511
3993
|
} else if (pluginLicense) {
|
|
2512
3994
|
resolve(pluginLicense);
|
|
2513
3995
|
} else {
|
|
2514
|
-
reject(
|
|
3996
|
+
reject(ERROR_CODE_ERROR, @"no plugin lincense", nil);
|
|
2515
3997
|
}
|
|
2516
3998
|
}];
|
|
2517
3999
|
}
|
|
@@ -2525,13 +4007,17 @@ RCT_REMAP_METHOD(getPluginOrders,
|
|
|
2525
4007
|
getPluginOrdersWithResolver:(RCTPromiseResolveBlock)resolve
|
|
2526
4008
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2527
4009
|
{
|
|
4010
|
+
if (!_theta) {
|
|
4011
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
4012
|
+
return;
|
|
4013
|
+
}
|
|
2528
4014
|
[_theta getPluginOrdersWithCompletionHandler:^(NSArray *pluginOrders, NSError *error) {
|
|
2529
4015
|
if (error) {
|
|
2530
|
-
reject(
|
|
4016
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2531
4017
|
} else if (pluginOrders) {
|
|
2532
4018
|
resolve(pluginOrders);
|
|
2533
4019
|
} else {
|
|
2534
|
-
reject(
|
|
4020
|
+
reject(ERROR_CODE_ERROR, @"no plugin orders", nil);
|
|
2535
4021
|
}
|
|
2536
4022
|
}];
|
|
2537
4023
|
}
|
|
@@ -2547,10 +4033,14 @@ RCT_REMAP_METHOD(setPluginOrders,
|
|
|
2547
4033
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2548
4034
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2549
4035
|
{
|
|
4036
|
+
if (!_theta) {
|
|
4037
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
4038
|
+
return;
|
|
4039
|
+
}
|
|
2550
4040
|
[_theta setPluginOrdersPlugins:plugins
|
|
2551
4041
|
completionHandler:^(NSError *error) {
|
|
2552
4042
|
if (error) {
|
|
2553
|
-
reject(
|
|
4043
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2554
4044
|
} else {
|
|
2555
4045
|
resolve(@(YES));
|
|
2556
4046
|
}
|
|
@@ -2568,10 +4058,14 @@ RCT_REMAP_METHOD(setBluetoothDevice,
|
|
|
2568
4058
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
2569
4059
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
2570
4060
|
{
|
|
4061
|
+
if (!_theta) {
|
|
4062
|
+
reject(ERROR_CODE_ERROR, MESSAGE_NOT_INIT, nil);
|
|
4063
|
+
return;
|
|
4064
|
+
}
|
|
2571
4065
|
[_theta setBluetoothDeviceUuid:uuid
|
|
2572
4066
|
completionHandler:^(NSString *deviceName, NSError *error) {
|
|
2573
4067
|
if (error) {
|
|
2574
|
-
reject(
|
|
4068
|
+
reject(ERROR_CODE_ERROR, [error localizedDescription], error);
|
|
2575
4069
|
} else {
|
|
2576
4070
|
resolve(deviceName);
|
|
2577
4071
|
}
|