theta-client-react-native 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +375 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +391 -17
- package/ios/ThetaClientReactNative.h +6 -0
- package/ios/ThetaClientReactNative.mm +1125 -132
- 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 +91 -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 +110 -0
- package/lib/commonjs/theta-repository/options/index.js.map +1 -1
- 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-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-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 +30 -2
- 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 +13 -1
- package/lib/commonjs/theta-repository/theta-files.js.map +1 -1
- package/lib/commonjs/theta-repository/theta-repository.js +39 -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 +83 -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 +10 -0
- package/lib/module/theta-repository/options/index.js.map +1 -1
- 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-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-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 +30 -2
- 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 +12 -0
- package/lib/module/theta-repository/theta-files.js.map +1 -1
- package/lib/module/theta-repository/theta-repository.js +38 -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/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 +44 -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 +10 -0
- package/lib/typescript/theta-repository/options/index.d.ts.map +1 -1
- 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-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-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 +73 -6
- 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 +14 -1
- package/lib/typescript/theta-repository/theta-files.d.ts.map +1 -1
- package/lib/typescript/theta-repository/theta-repository.d.ts +28 -7
- package/lib/typescript/theta-repository/theta-repository.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/index.ts +1 -0
- package/src/capture/notify.ts +27 -0
- package/src/capture/time-shift-capture.ts +99 -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 +11 -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-network-type.ts +20 -0
- package/src/theta-repository/options/option-power-saving.ts +18 -0
- package/src/theta-repository/options/option-preview-format.ts +27 -0
- package/src/theta-repository/options/option-proxy.ts +22 -0
- package/src/theta-repository/options/option-shooting-method.ts +36 -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 +74 -6
- package/src/theta-repository/theta-config.ts +20 -0
- package/src/theta-repository/theta-files.ts +16 -1
- package/src/theta-repository/theta-repository.ts +68 -17
- package/src/theta-repository/theta-timeout.ts +21 -0
- package/theta-client-react-native.podspec +1 -1
|
@@ -3,14 +3,11 @@ package com.ricoh360.thetaclientreactnative
|
|
|
3
3
|
import com.facebook.react.bridge.*
|
|
4
4
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
5
5
|
import com.ricoh360.thetaclient.ThetaRepository
|
|
6
|
-
import com.ricoh360.thetaclient.capture
|
|
7
|
-
import com.ricoh360.thetaclient.capture.VideoCapture
|
|
8
|
-
import com.ricoh360.thetaclient.capture.VideoCapturing
|
|
6
|
+
import com.ricoh360.thetaclient.capture.*
|
|
9
7
|
import io.ktor.utils.io.core.*
|
|
10
8
|
import kotlinx.coroutines.*
|
|
11
|
-
import java.io.ByteArrayOutputStream
|
|
12
|
-
import kotlin.coroutines.*
|
|
13
9
|
import java.util.*
|
|
10
|
+
import kotlin.coroutines.*
|
|
14
11
|
import kotlin.text.String
|
|
15
12
|
|
|
16
13
|
class ThetaClientReactNativeModule(
|
|
@@ -26,12 +23,17 @@ class ThetaClientReactNativeModule(
|
|
|
26
23
|
var previewing: Boolean = false
|
|
27
24
|
var photoCaptureBuilder: PhotoCapture.Builder? = null
|
|
28
25
|
var photoCapture: PhotoCapture? = null
|
|
26
|
+
var timeShiftCaptureBuilder: TimeShiftCapture.Builder? = null
|
|
27
|
+
var timeShiftCapture: TimeShiftCapture? = null
|
|
28
|
+
var timeShiftCapturing: TimeShiftCapturing? = null
|
|
29
29
|
var videoCaptureBuilder: VideoCapture.Builder? = null
|
|
30
30
|
var videoCapture: VideoCapture? = null
|
|
31
31
|
var videoCapturing: VideoCapturing? = null
|
|
32
|
-
|
|
32
|
+
var theta: ThetaRepository? = null
|
|
33
33
|
var listenerCount: Int = 0
|
|
34
34
|
|
|
35
|
+
val messageNotInit: String = "Not initialized."
|
|
36
|
+
|
|
35
37
|
/**
|
|
36
38
|
* add event listener for [eventName]
|
|
37
39
|
*/
|
|
@@ -52,6 +54,12 @@ class ThetaClientReactNativeModule(
|
|
|
52
54
|
listenerCount -= count
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
fun sendNotifyEvent(param: WritableMap) {
|
|
58
|
+
reactApplicationContext
|
|
59
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
60
|
+
.emit(EVENT_NOTIFY, param)
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
/**
|
|
56
64
|
* retreive constant
|
|
57
65
|
*/
|
|
@@ -64,10 +72,25 @@ class ThetaClientReactNativeModule(
|
|
|
64
72
|
* @param promise promise to set initialize result
|
|
65
73
|
*/
|
|
66
74
|
@ReactMethod
|
|
67
|
-
fun initialize(endpoint: String, promise: Promise) {
|
|
75
|
+
fun initialize(endpoint: String, config: ReadableMap?, timeout: ReadableMap?, promise: Promise) {
|
|
68
76
|
launch {
|
|
69
77
|
try {
|
|
70
|
-
theta =
|
|
78
|
+
theta = null
|
|
79
|
+
previewing = false
|
|
80
|
+
photoCaptureBuilder = null
|
|
81
|
+
photoCapture = null
|
|
82
|
+
timeShiftCaptureBuilder = null
|
|
83
|
+
timeShiftCapture = null
|
|
84
|
+
timeShiftCapturing = null
|
|
85
|
+
videoCaptureBuilder = null
|
|
86
|
+
videoCapture = null
|
|
87
|
+
videoCapturing = null
|
|
88
|
+
|
|
89
|
+
theta = ThetaRepository.newInstance(
|
|
90
|
+
endpoint,
|
|
91
|
+
config?.let { configToTheta(it) },
|
|
92
|
+
timeout?.let { timeoutToTheta(it) }
|
|
93
|
+
)
|
|
71
94
|
promise.resolve(true)
|
|
72
95
|
} catch (t: Throwable) {
|
|
73
96
|
promise.reject(t)
|
|
@@ -75,12 +98,26 @@ class ThetaClientReactNativeModule(
|
|
|
75
98
|
}
|
|
76
99
|
}
|
|
77
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Returns whether it is initialized or not.
|
|
103
|
+
* @param promise promise to set result
|
|
104
|
+
*/
|
|
105
|
+
@ReactMethod
|
|
106
|
+
fun isInitialized(promise: Promise) {
|
|
107
|
+
promise.resolve(theta != null)
|
|
108
|
+
}
|
|
109
|
+
|
|
78
110
|
/**
|
|
79
111
|
* getThetaInfo - retrieve ThetaInfo from THETA via repository
|
|
80
112
|
* @param promise promise to set result
|
|
81
113
|
*/
|
|
82
114
|
@ReactMethod
|
|
83
115
|
fun getThetaInfo(promise: Promise) {
|
|
116
|
+
val theta = theta
|
|
117
|
+
if (theta == null) {
|
|
118
|
+
promise.reject(Exception(messageNotInit))
|
|
119
|
+
return
|
|
120
|
+
}
|
|
84
121
|
launch {
|
|
85
122
|
try {
|
|
86
123
|
val info = theta.getThetaInfo()
|
|
@@ -118,6 +155,11 @@ class ThetaClientReactNativeModule(
|
|
|
118
155
|
*/
|
|
119
156
|
@ReactMethod
|
|
120
157
|
fun getThetaState(promise: Promise) {
|
|
158
|
+
val theta = theta
|
|
159
|
+
if (theta == null) {
|
|
160
|
+
promise.reject(Exception(messageNotInit))
|
|
161
|
+
return
|
|
162
|
+
}
|
|
121
163
|
launch {
|
|
122
164
|
try {
|
|
123
165
|
val state = theta.getThetaState()
|
|
@@ -170,16 +212,23 @@ class ThetaClientReactNativeModule(
|
|
|
170
212
|
* @param fileType file type to retrieve
|
|
171
213
|
* @param startPosition start position to retrieve
|
|
172
214
|
* @param entryCount count to retrieve
|
|
215
|
+
* @param storage Desired storage
|
|
173
216
|
* @param promise promise to set result
|
|
174
217
|
*/
|
|
175
218
|
@ReactMethod
|
|
176
|
-
fun listFiles(fileType: String, startPosition: Int, entryCount: Int, promise: Promise) {
|
|
219
|
+
fun listFiles(fileType: String, startPosition: Int, entryCount: Int, storage: String?, promise: Promise) {
|
|
220
|
+
val theta = theta
|
|
221
|
+
if (theta == null) {
|
|
222
|
+
promise.reject(Exception(messageNotInit))
|
|
223
|
+
return
|
|
224
|
+
}
|
|
177
225
|
launch {
|
|
178
226
|
try {
|
|
179
227
|
val (fileList, totalEntries) = theta.listFiles(
|
|
180
228
|
ThetaRepository.FileTypeEnum.valueOf(fileType),
|
|
181
229
|
startPosition,
|
|
182
|
-
entryCount
|
|
230
|
+
entryCount,
|
|
231
|
+
storage?.let { ThetaRepository.StorageEnum.valueOf(it) },
|
|
183
232
|
)
|
|
184
233
|
val resultlist = Arguments.createArray()
|
|
185
234
|
fileList.forEach {
|
|
@@ -189,6 +238,9 @@ class ThetaClientReactNativeModule(
|
|
|
189
238
|
result.putString("dateTime", it.dateTime)
|
|
190
239
|
result.putString("thumbnailUrl", it.thumbnailUrl)
|
|
191
240
|
result.putString("fileUrl", it.fileUrl)
|
|
241
|
+
it.storageID?.run {
|
|
242
|
+
result.putString("storageID", this)
|
|
243
|
+
}
|
|
192
244
|
resultlist.pushMap(result)
|
|
193
245
|
}
|
|
194
246
|
val resultmap = Arguments.createMap()
|
|
@@ -208,6 +260,11 @@ class ThetaClientReactNativeModule(
|
|
|
208
260
|
*/
|
|
209
261
|
@ReactMethod
|
|
210
262
|
fun deleteFiles(fileUrls: ReadableArray, promise: Promise) {
|
|
263
|
+
val theta = theta
|
|
264
|
+
if (theta == null) {
|
|
265
|
+
promise.reject(Exception(messageNotInit))
|
|
266
|
+
return
|
|
267
|
+
}
|
|
211
268
|
val fileList = mutableListOf<String>()
|
|
212
269
|
for (index in 0..(fileUrls.size() - 1)) {
|
|
213
270
|
fileList.add(fileUrls.getString(index))
|
|
@@ -228,6 +285,11 @@ class ThetaClientReactNativeModule(
|
|
|
228
285
|
*/
|
|
229
286
|
@ReactMethod
|
|
230
287
|
fun deleteAllFiles(promise: Promise) {
|
|
288
|
+
val theta = theta
|
|
289
|
+
if (theta == null) {
|
|
290
|
+
promise.reject(Exception(messageNotInit))
|
|
291
|
+
return
|
|
292
|
+
}
|
|
231
293
|
launch {
|
|
232
294
|
try {
|
|
233
295
|
theta.deleteAllFiles()
|
|
@@ -244,6 +306,11 @@ class ThetaClientReactNativeModule(
|
|
|
244
306
|
*/
|
|
245
307
|
@ReactMethod
|
|
246
308
|
fun deleteAllImageFiles(promise: Promise) {
|
|
309
|
+
val theta = theta
|
|
310
|
+
if (theta == null) {
|
|
311
|
+
promise.reject(Exception(messageNotInit))
|
|
312
|
+
return
|
|
313
|
+
}
|
|
247
314
|
launch {
|
|
248
315
|
try {
|
|
249
316
|
theta.deleteAllImageFiles()
|
|
@@ -260,6 +327,11 @@ class ThetaClientReactNativeModule(
|
|
|
260
327
|
*/
|
|
261
328
|
@ReactMethod
|
|
262
329
|
fun deleteAllVideoFiles(promise: Promise) {
|
|
330
|
+
val theta = theta
|
|
331
|
+
if (theta == null) {
|
|
332
|
+
promise.reject(Exception(messageNotInit))
|
|
333
|
+
return
|
|
334
|
+
}
|
|
263
335
|
launch {
|
|
264
336
|
try {
|
|
265
337
|
theta.deleteAllVideoFiles()
|
|
@@ -274,6 +346,8 @@ class ThetaClientReactNativeModule(
|
|
|
274
346
|
private val converters = mapOf(
|
|
275
347
|
"aperture" to ApertureConverter(),
|
|
276
348
|
"bluetoothPower" to BluetoothPowerConverter(),
|
|
349
|
+
"cameraControlSource" to CameraControlSourceConverter(),
|
|
350
|
+
"cameraMode" to CameraModeConverter(),
|
|
277
351
|
"captureMode" to CaptureModeConverter(),
|
|
278
352
|
"colorTemperature" to ColorTemperatureConverter(),
|
|
279
353
|
"dateTimeZone" to DateTimeZoneConverter(),
|
|
@@ -288,15 +362,25 @@ class ThetaClientReactNativeModule(
|
|
|
288
362
|
"isoAutoHighLimit" to IsoAutoHighLimitConverter(),
|
|
289
363
|
"language" to LanguageConverter(),
|
|
290
364
|
"maxRecordableTime" to MaxRecordableTimeConverter(),
|
|
365
|
+
"networkType" to NetworkTypeConverter(),
|
|
291
366
|
"offDelay" to OffDelayConverter(),
|
|
292
|
-
"
|
|
367
|
+
"password" to PasswordConverter(),
|
|
368
|
+
"powerSaving" to PowerSavingConverter(),
|
|
369
|
+
"previewFormat" to PreviewFormatConverter(),
|
|
370
|
+
"proxy" to ProxyConverter(),
|
|
293
371
|
"remainingPictures" to RemainingPicturesConverter(),
|
|
294
372
|
"remainingVideoSeconds" to RemainingVideoSecondsConverter(),
|
|
295
373
|
"remainingSpace" to RemainingSpaceConverter(),
|
|
296
|
-
"
|
|
374
|
+
"shootingMethod" to ShootingMethodConverter(),
|
|
375
|
+
"shutterSpeed" to ShutterSpeedConverter(),
|
|
297
376
|
"shutterVolume" to ShutterVolumeConverter(),
|
|
377
|
+
"sleepDelay" to SleepDelayConverter(),
|
|
378
|
+
"timeShift" to TimeShiftConverter(),
|
|
379
|
+
"totalSpace" to TotalSpaceConverter(),
|
|
380
|
+
"username" to UsernameConverter(),
|
|
298
381
|
"whiteBalance" to WhiteBalanceConverter(),
|
|
299
382
|
"whiteBalanceAutoStrength" to WhiteBalanceAutoStrengthConverter(),
|
|
383
|
+
"wlanFrequency" to WlanFrequencyConverter(),
|
|
300
384
|
"_gpsTagRecording" to GpsTagRecordingConverter(),
|
|
301
385
|
)
|
|
302
386
|
|
|
@@ -304,6 +388,8 @@ class ThetaClientReactNativeModule(
|
|
|
304
388
|
private val optionEnumToOption = mapOf(
|
|
305
389
|
"Aperture" to "aperture",
|
|
306
390
|
"BluetoothPower" to "bluetoothPower",
|
|
391
|
+
"CameraControlSource" to "cameraControlSource",
|
|
392
|
+
"CameraMode" to "cameraMode",
|
|
307
393
|
"CaptureMode" to "captureMode",
|
|
308
394
|
"ColorTemperature" to "colorTemperature",
|
|
309
395
|
"DateTimeZone" to "dateTimeZone",
|
|
@@ -318,15 +404,25 @@ class ThetaClientReactNativeModule(
|
|
|
318
404
|
"IsoAutoHighLimit" to "isoAutoHighLimit",
|
|
319
405
|
"Language" to "language",
|
|
320
406
|
"MaxRecordableTime" to "maxRecordableTime",
|
|
407
|
+
"NetworkType" to "networkType",
|
|
321
408
|
"OffDelay" to "offDelay",
|
|
322
|
-
"
|
|
409
|
+
"Password" to "password",
|
|
410
|
+
"PowerSaving" to "powerSaving",
|
|
411
|
+
"PreviewFormat" to "previewFormat",
|
|
412
|
+
"Proxy" to "proxy",
|
|
323
413
|
"RemainingPictures" to "remainingPictures",
|
|
324
414
|
"RemainingVideoSeconds" to "remainingVideoSeconds",
|
|
325
415
|
"RemainingSpace" to "remainingSpace",
|
|
326
|
-
"
|
|
416
|
+
"ShootingMethod" to "shootingMethod",
|
|
417
|
+
"ShutterSpeed" to "shutterSpeed",
|
|
327
418
|
"ShutterVolume" to "shutterVolume",
|
|
419
|
+
"SleepDelay" to "sleepDelay",
|
|
420
|
+
"TimeShift" to "timeShift",
|
|
421
|
+
"TotalSpace" to "totalSpace",
|
|
422
|
+
"Username" to "username",
|
|
328
423
|
"WhiteBalance" to "whiteBalance",
|
|
329
424
|
"WhiteBalanceAutoStrength" to "whiteBalanceAutoStrength",
|
|
425
|
+
"WlanFrequency" to "wlanFrequency",
|
|
330
426
|
)
|
|
331
427
|
|
|
332
428
|
/**
|
|
@@ -336,6 +432,11 @@ class ThetaClientReactNativeModule(
|
|
|
336
432
|
*/
|
|
337
433
|
@ReactMethod
|
|
338
434
|
fun getOptions(optionNames: ReadableArray, promise: Promise) {
|
|
435
|
+
val theta = theta
|
|
436
|
+
if (theta == null) {
|
|
437
|
+
promise.reject(Exception(messageNotInit))
|
|
438
|
+
return
|
|
439
|
+
}
|
|
339
440
|
launch {
|
|
340
441
|
try {
|
|
341
442
|
val optionNameList = mutableListOf<ThetaRepository.OptionNameEnum>()
|
|
@@ -365,6 +466,11 @@ class ThetaClientReactNativeModule(
|
|
|
365
466
|
*/
|
|
366
467
|
@ReactMethod
|
|
367
468
|
fun setOptions(options: ReadableMap, promise: Promise) {
|
|
469
|
+
val theta = theta
|
|
470
|
+
if (theta == null) {
|
|
471
|
+
promise.reject(Exception(messageNotInit))
|
|
472
|
+
return
|
|
473
|
+
}
|
|
368
474
|
launch {
|
|
369
475
|
try {
|
|
370
476
|
val thetaOptions = ThetaRepository.Options()
|
|
@@ -388,6 +494,11 @@ class ThetaClientReactNativeModule(
|
|
|
388
494
|
*/
|
|
389
495
|
@ReactMethod
|
|
390
496
|
fun getLivePreview(promise: Promise) {
|
|
497
|
+
val theta = theta
|
|
498
|
+
if (theta == null) {
|
|
499
|
+
promise.reject(Exception(messageNotInit))
|
|
500
|
+
return
|
|
501
|
+
}
|
|
391
502
|
fun ByteArray.toBase64(): String = String(Base64.getEncoder().encode(this))
|
|
392
503
|
suspend fun callFrameHandler(packet: Pair<ByteArray, Int>): Boolean {
|
|
393
504
|
if (listenerCount == 0) {
|
|
@@ -420,6 +531,9 @@ class ThetaClientReactNativeModule(
|
|
|
420
531
|
*/
|
|
421
532
|
@ReactMethod
|
|
422
533
|
fun stopLivePreview() {
|
|
534
|
+
if (theta == null) {
|
|
535
|
+
throw Exception(messageNotInit)
|
|
536
|
+
}
|
|
423
537
|
previewing = false
|
|
424
538
|
}
|
|
425
539
|
|
|
@@ -428,6 +542,7 @@ class ThetaClientReactNativeModule(
|
|
|
428
542
|
*/
|
|
429
543
|
@ReactMethod
|
|
430
544
|
fun getPhotoCaptureBuilder() {
|
|
545
|
+
val theta = theta ?: throw Exception(messageNotInit)
|
|
431
546
|
photoCaptureBuilder = theta.getPhotoCaptureBuilder()
|
|
432
547
|
}
|
|
433
548
|
|
|
@@ -439,6 +554,9 @@ class ThetaClientReactNativeModule(
|
|
|
439
554
|
*/
|
|
440
555
|
@ReactMethod
|
|
441
556
|
fun buildPhotoCapture(options: ReadableMap, promise: Promise) {
|
|
557
|
+
if (theta == null) {
|
|
558
|
+
throw Exception(messageNotInit)
|
|
559
|
+
}
|
|
442
560
|
if (photoCaptureBuilder == null) {
|
|
443
561
|
promise.reject(Exception("no photoCaptureBuilder"))
|
|
444
562
|
return
|
|
@@ -467,6 +585,10 @@ class ThetaClientReactNativeModule(
|
|
|
467
585
|
*/
|
|
468
586
|
@ReactMethod
|
|
469
587
|
fun takePicture(promise: Promise) {
|
|
588
|
+
if (theta == null) {
|
|
589
|
+
promise.reject(Exception(messageNotInit))
|
|
590
|
+
return
|
|
591
|
+
}
|
|
470
592
|
if (photoCapture == null) {
|
|
471
593
|
promise.reject(Exception("no photoCapture"))
|
|
472
594
|
return
|
|
@@ -487,11 +609,107 @@ class ThetaClientReactNativeModule(
|
|
|
487
609
|
}
|
|
488
610
|
}
|
|
489
611
|
|
|
612
|
+
/**
|
|
613
|
+
* getTimeShiftCaptureBuilder - get time-shift builder from repository
|
|
614
|
+
*/
|
|
615
|
+
@ReactMethod
|
|
616
|
+
fun getTimeShiftCaptureBuilder() {
|
|
617
|
+
val theta = theta ?: throw Exception(messageNotInit)
|
|
618
|
+
timeShiftCaptureBuilder = theta.getTimeShiftCaptureBuilder()
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* buildTimeShiftCapture - build time-shift
|
|
623
|
+
* @param options option to execute time-shift
|
|
624
|
+
* @param interval interval of checking time-shift status
|
|
625
|
+
* @param promise Promise for buildTimeShiftCapture
|
|
626
|
+
*/
|
|
627
|
+
@ReactMethod
|
|
628
|
+
fun buildTimeShiftCapture(options: ReadableMap, interval: Int, promise: Promise) {
|
|
629
|
+
if (theta == null) {
|
|
630
|
+
promise.reject(Exception(messageNotInit))
|
|
631
|
+
return
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
timeShiftCaptureBuilder?.let { builder ->
|
|
635
|
+
launch {
|
|
636
|
+
try {
|
|
637
|
+
val iterator = options.keySetIterator()
|
|
638
|
+
while (iterator.hasNextKey()) {
|
|
639
|
+
val key = iterator.nextKey()
|
|
640
|
+
val cvt = converters[key]
|
|
641
|
+
cvt?.setTimeShiftOption(options, builder)
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
if (interval >= 0) {
|
|
645
|
+
builder.setCheckStatusCommandInterval(interval.toLong())
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
timeShiftCapture = builder.build()
|
|
649
|
+
promise.resolve(true)
|
|
650
|
+
timeShiftCaptureBuilder = null
|
|
651
|
+
} catch (t: Throwable) {
|
|
652
|
+
promise.reject(t)
|
|
653
|
+
timeShiftCaptureBuilder = null
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
} ?: run {
|
|
657
|
+
promise.reject(Exception("no timeShiftCaptureBuilder"))
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* startTimeShiftCapture - start time-shift
|
|
663
|
+
* @param promise promise for startTimeShiftCapture
|
|
664
|
+
*/
|
|
665
|
+
@ReactMethod
|
|
666
|
+
fun startTimeShiftCapture(promise: Promise) {
|
|
667
|
+
if (theta == null) {
|
|
668
|
+
promise.reject(Exception(messageNotInit))
|
|
669
|
+
return
|
|
670
|
+
}
|
|
671
|
+
timeShiftCapture?.let { capture ->
|
|
672
|
+
class StartCaptureCallback : TimeShiftCapture.StartCaptureCallback {
|
|
673
|
+
override fun onSuccess(fileUrl: String?) {
|
|
674
|
+
promise.resolve(fileUrl)
|
|
675
|
+
timeShiftCapture = null
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
override fun onProgress(completion: Float) {
|
|
679
|
+
sendNotifyEvent(
|
|
680
|
+
toNotify("TIME-SHIFT-PROGRESS", toCaptureProgressNotifyParam(value = completion))
|
|
681
|
+
)
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
override fun onError(exception: ThetaRepository.ThetaRepositoryException) {
|
|
685
|
+
promise.reject(exception)
|
|
686
|
+
timeShiftCapture = null
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
timeShiftCapturing = capture.startCapture(StartCaptureCallback())
|
|
690
|
+
} ?: run {
|
|
691
|
+
promise.reject(Exception("no timeShiftCapture"))
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* cancelTimeShiftCapture - stop time-shift
|
|
697
|
+
* @param promise promise for stopTimeShiftCapture
|
|
698
|
+
*/
|
|
699
|
+
@ReactMethod
|
|
700
|
+
fun cancelTimeShiftCapture(promise: Promise) {
|
|
701
|
+
if (theta == null) {
|
|
702
|
+
throw Exception(messageNotInit)
|
|
703
|
+
}
|
|
704
|
+
timeShiftCapturing?.cancelCapture()
|
|
705
|
+
}
|
|
706
|
+
|
|
490
707
|
/**
|
|
491
708
|
* getVideoCaptureBuilder - get video capture builder
|
|
492
709
|
*/
|
|
493
710
|
@ReactMethod
|
|
494
711
|
fun getVideoCaptureBuilder() {
|
|
712
|
+
val theta = theta ?: throw Exception(messageNotInit)
|
|
495
713
|
videoCaptureBuilder = theta.getVideoCaptureBuilder()
|
|
496
714
|
}
|
|
497
715
|
|
|
@@ -502,6 +720,10 @@ class ThetaClientReactNativeModule(
|
|
|
502
720
|
*/
|
|
503
721
|
@ReactMethod
|
|
504
722
|
fun buildVideoCapture(options: ReadableMap, promise: Promise) {
|
|
723
|
+
if (theta == null) {
|
|
724
|
+
promise.reject(Exception(messageNotInit))
|
|
725
|
+
return
|
|
726
|
+
}
|
|
505
727
|
if (videoCaptureBuilder == null) {
|
|
506
728
|
promise.reject(Exception("no videoCaptureBuilder"))
|
|
507
729
|
return
|
|
@@ -530,6 +752,10 @@ class ThetaClientReactNativeModule(
|
|
|
530
752
|
*/
|
|
531
753
|
@ReactMethod
|
|
532
754
|
fun startCapture(promise: Promise) {
|
|
755
|
+
if (theta == null) {
|
|
756
|
+
promise.reject(Exception(messageNotInit))
|
|
757
|
+
return
|
|
758
|
+
}
|
|
533
759
|
if (videoCapture == null) {
|
|
534
760
|
promise.reject(Exception("no videoCapture"))
|
|
535
761
|
return
|
|
@@ -555,6 +781,9 @@ class ThetaClientReactNativeModule(
|
|
|
555
781
|
*/
|
|
556
782
|
@ReactMethod
|
|
557
783
|
fun stopCapture() {
|
|
784
|
+
if (theta == null) {
|
|
785
|
+
throw Exception(messageNotInit)
|
|
786
|
+
}
|
|
558
787
|
videoCapturing?.stopCapture()
|
|
559
788
|
}
|
|
560
789
|
|
|
@@ -564,6 +793,11 @@ class ThetaClientReactNativeModule(
|
|
|
564
793
|
*/
|
|
565
794
|
@ReactMethod
|
|
566
795
|
fun getMetadata(fileUrl: String, promise: Promise) {
|
|
796
|
+
val theta = theta
|
|
797
|
+
if (theta == null) {
|
|
798
|
+
promise.reject(Exception(messageNotInit))
|
|
799
|
+
return
|
|
800
|
+
}
|
|
567
801
|
launch {
|
|
568
802
|
try {
|
|
569
803
|
val metaData = theta.getMetadata(fileUrl)
|
|
@@ -598,6 +832,11 @@ class ThetaClientReactNativeModule(
|
|
|
598
832
|
*/
|
|
599
833
|
@ReactMethod
|
|
600
834
|
fun reset(promise: Promise) {
|
|
835
|
+
val theta = theta
|
|
836
|
+
if (theta == null) {
|
|
837
|
+
promise.reject(Exception(messageNotInit))
|
|
838
|
+
return
|
|
839
|
+
}
|
|
601
840
|
launch {
|
|
602
841
|
try {
|
|
603
842
|
theta.reset()
|
|
@@ -614,6 +853,11 @@ class ThetaClientReactNativeModule(
|
|
|
614
853
|
*/
|
|
615
854
|
@ReactMethod
|
|
616
855
|
fun restoreSettings(promise: Promise) {
|
|
856
|
+
val theta = theta
|
|
857
|
+
if (theta == null) {
|
|
858
|
+
promise.reject(Exception(messageNotInit))
|
|
859
|
+
return
|
|
860
|
+
}
|
|
617
861
|
launch {
|
|
618
862
|
try {
|
|
619
863
|
theta.restoreSettings()
|
|
@@ -630,6 +874,11 @@ class ThetaClientReactNativeModule(
|
|
|
630
874
|
*/
|
|
631
875
|
@ReactMethod
|
|
632
876
|
fun stopSelfTimer(promise: Promise) {
|
|
877
|
+
val theta = theta
|
|
878
|
+
if (theta == null) {
|
|
879
|
+
promise.reject(Exception(messageNotInit))
|
|
880
|
+
return
|
|
881
|
+
}
|
|
633
882
|
launch {
|
|
634
883
|
try {
|
|
635
884
|
theta.stopSelfTimer()
|
|
@@ -654,6 +903,11 @@ class ThetaClientReactNativeModule(
|
|
|
654
903
|
applyTopBottomCorrection: Boolean,
|
|
655
904
|
promise: Promise,
|
|
656
905
|
) {
|
|
906
|
+
val theta = theta
|
|
907
|
+
if (theta == null) {
|
|
908
|
+
promise.reject(Exception(messageNotInit))
|
|
909
|
+
return
|
|
910
|
+
}
|
|
657
911
|
launch {
|
|
658
912
|
try {
|
|
659
913
|
val convertedUrl = theta.convertVideoFormats(fileUrl, is4k, applyTopBottomCorrection)
|
|
@@ -671,6 +925,11 @@ class ThetaClientReactNativeModule(
|
|
|
671
925
|
*/
|
|
672
926
|
@ReactMethod
|
|
673
927
|
fun cancelVideoConvert(promise: Promise) {
|
|
928
|
+
val theta = theta
|
|
929
|
+
if (theta == null) {
|
|
930
|
+
promise.reject(Exception(messageNotInit))
|
|
931
|
+
return
|
|
932
|
+
}
|
|
674
933
|
launch {
|
|
675
934
|
try {
|
|
676
935
|
theta.cancelVideoConvert()
|
|
@@ -687,6 +946,11 @@ class ThetaClientReactNativeModule(
|
|
|
687
946
|
*/
|
|
688
947
|
@ReactMethod
|
|
689
948
|
fun finishWlan(promise: Promise) {
|
|
949
|
+
val theta = theta
|
|
950
|
+
if (theta == null) {
|
|
951
|
+
promise.reject(Exception(messageNotInit))
|
|
952
|
+
return
|
|
953
|
+
}
|
|
690
954
|
launch {
|
|
691
955
|
try {
|
|
692
956
|
theta.finishWlan()
|
|
@@ -703,6 +967,11 @@ class ThetaClientReactNativeModule(
|
|
|
703
967
|
*/
|
|
704
968
|
@ReactMethod
|
|
705
969
|
fun listAccessPoints(promise: Promise) {
|
|
970
|
+
val theta = theta
|
|
971
|
+
if (theta == null) {
|
|
972
|
+
promise.reject(Exception(messageNotInit))
|
|
973
|
+
return
|
|
974
|
+
}
|
|
706
975
|
launch {
|
|
707
976
|
try {
|
|
708
977
|
val result = Arguments.createArray()
|
|
@@ -716,6 +985,15 @@ class ThetaClientReactNativeModule(
|
|
|
716
985
|
apinfo.putString("ipAddress", it.ipAddress)
|
|
717
986
|
apinfo.putString("subnetMask", it.subnetMask)
|
|
718
987
|
apinfo.putString("defaultGateway", it.defaultGateway)
|
|
988
|
+
|
|
989
|
+
it.proxy?.let { proxy ->
|
|
990
|
+
var options = ThetaRepository.Options(proxy = proxy)
|
|
991
|
+
val optionsMap = Arguments.createMap()
|
|
992
|
+
val cvt = converters["proxy"]
|
|
993
|
+
cvt?.setFromTheta(options, optionsMap)
|
|
994
|
+
apinfo.putMap("proxy", optionsMap.getMap("proxy"))
|
|
995
|
+
}
|
|
996
|
+
|
|
719
997
|
result.pushMap(apinfo)
|
|
720
998
|
}
|
|
721
999
|
promise.resolve(result)
|
|
@@ -732,6 +1010,7 @@ class ThetaClientReactNativeModule(
|
|
|
732
1010
|
* @param authMode auth mode to connect
|
|
733
1011
|
* @param password password to connect with auth
|
|
734
1012
|
* @param connectionPriority connection priority
|
|
1013
|
+
* @param proxy Proxy information to be used for the access point.
|
|
735
1014
|
* @param promise promise to set result
|
|
736
1015
|
*/
|
|
737
1016
|
@ReactMethod
|
|
@@ -741,8 +1020,14 @@ class ThetaClientReactNativeModule(
|
|
|
741
1020
|
authMode: String,
|
|
742
1021
|
password: String,
|
|
743
1022
|
connectionPriority: Int,
|
|
1023
|
+
proxy: ReadableMap?,
|
|
744
1024
|
promise: Promise
|
|
745
1025
|
) {
|
|
1026
|
+
val theta = theta
|
|
1027
|
+
if (theta == null) {
|
|
1028
|
+
promise.reject(Exception(messageNotInit))
|
|
1029
|
+
return
|
|
1030
|
+
}
|
|
746
1031
|
launch {
|
|
747
1032
|
try {
|
|
748
1033
|
theta.setAccessPointDynamically(
|
|
@@ -750,7 +1035,8 @@ class ThetaClientReactNativeModule(
|
|
|
750
1035
|
ssidStealth,
|
|
751
1036
|
ThetaRepository.AuthModeEnum.valueOf(authMode),
|
|
752
1037
|
password,
|
|
753
|
-
connectionPriority
|
|
1038
|
+
connectionPriority,
|
|
1039
|
+
convertMapToProxy(proxyMap = proxy)
|
|
754
1040
|
)
|
|
755
1041
|
promise.resolve(true)
|
|
756
1042
|
} catch (t: Throwable) {
|
|
@@ -770,6 +1056,7 @@ class ThetaClientReactNativeModule(
|
|
|
770
1056
|
* @param subnetMask subnet mask for ip address
|
|
771
1057
|
* @param defaultGateway default gateway address
|
|
772
1058
|
* @param promise promise to set result
|
|
1059
|
+
* @param proxy Proxy information to be used for the access point.
|
|
773
1060
|
*/
|
|
774
1061
|
@ReactMethod
|
|
775
1062
|
fun setAccessPointStatically(
|
|
@@ -781,8 +1068,14 @@ class ThetaClientReactNativeModule(
|
|
|
781
1068
|
ipAddress: String,
|
|
782
1069
|
subnetMask: String,
|
|
783
1070
|
defaultGateway: String,
|
|
1071
|
+
proxy: ReadableMap?,
|
|
784
1072
|
promise: Promise
|
|
785
1073
|
) {
|
|
1074
|
+
val theta = theta
|
|
1075
|
+
if (theta == null) {
|
|
1076
|
+
promise.reject(Exception(messageNotInit))
|
|
1077
|
+
return
|
|
1078
|
+
}
|
|
786
1079
|
launch {
|
|
787
1080
|
try {
|
|
788
1081
|
theta.setAccessPointStatically(
|
|
@@ -794,6 +1087,7 @@ class ThetaClientReactNativeModule(
|
|
|
794
1087
|
ipAddress,
|
|
795
1088
|
subnetMask,
|
|
796
1089
|
defaultGateway,
|
|
1090
|
+
convertMapToProxy(proxyMap = proxy)
|
|
797
1091
|
)
|
|
798
1092
|
promise.resolve(true)
|
|
799
1093
|
} catch (t: Throwable) {
|
|
@@ -809,6 +1103,11 @@ class ThetaClientReactNativeModule(
|
|
|
809
1103
|
*/
|
|
810
1104
|
@ReactMethod
|
|
811
1105
|
fun deleteAccessPoint(ssid: String, promise: Promise) {
|
|
1106
|
+
val theta = theta
|
|
1107
|
+
if (theta == null) {
|
|
1108
|
+
promise.reject(Exception(messageNotInit))
|
|
1109
|
+
return
|
|
1110
|
+
}
|
|
812
1111
|
launch {
|
|
813
1112
|
try {
|
|
814
1113
|
theta.deleteAccessPoint(ssid)
|
|
@@ -819,6 +1118,20 @@ class ThetaClientReactNativeModule(
|
|
|
819
1118
|
}
|
|
820
1119
|
}
|
|
821
1120
|
|
|
1121
|
+
/**
|
|
1122
|
+
* convert ReadableMap to ThetaRepository.Proxy
|
|
1123
|
+
*/
|
|
1124
|
+
private fun convertMapToProxy(proxyMap: ReadableMap?): ThetaRepository.Proxy? {
|
|
1125
|
+
return proxyMap?.let {
|
|
1126
|
+
var options = ThetaRepository.Options()
|
|
1127
|
+
val optionsMap = Arguments.createMap()
|
|
1128
|
+
optionsMap.putMap("proxy", it)
|
|
1129
|
+
val cvt = converters["proxy"]
|
|
1130
|
+
cvt?.setToTheta(options, optionsMap)
|
|
1131
|
+
options.proxy
|
|
1132
|
+
} ?: null
|
|
1133
|
+
}
|
|
1134
|
+
|
|
822
1135
|
/**
|
|
823
1136
|
* setBluetoothDevice - register uuid of a BLE device
|
|
824
1137
|
* @param uuid uuid to set
|
|
@@ -826,6 +1139,11 @@ class ThetaClientReactNativeModule(
|
|
|
826
1139
|
*/
|
|
827
1140
|
@ReactMethod
|
|
828
1141
|
fun setBluetoothDevice(uuid: String, promise: Promise) {
|
|
1142
|
+
val theta = theta
|
|
1143
|
+
if (theta == null) {
|
|
1144
|
+
promise.reject(Exception(messageNotInit))
|
|
1145
|
+
return
|
|
1146
|
+
}
|
|
829
1147
|
launch {
|
|
830
1148
|
try {
|
|
831
1149
|
val deviceName = theta.setBluetoothDevice(uuid)
|
|
@@ -841,9 +1159,14 @@ class ThetaClientReactNativeModule(
|
|
|
841
1159
|
* Just for Theta V and later
|
|
842
1160
|
* @param captureMode The target shooting mode
|
|
843
1161
|
* @param promise promise to set result
|
|
844
|
-
|
|
1162
|
+
*/
|
|
845
1163
|
@ReactMethod
|
|
846
1164
|
fun getMySetting(captureMode: String, promise: Promise) {
|
|
1165
|
+
val theta = theta
|
|
1166
|
+
if (theta == null) {
|
|
1167
|
+
promise.reject(Exception(messageNotInit))
|
|
1168
|
+
return
|
|
1169
|
+
}
|
|
847
1170
|
launch {
|
|
848
1171
|
try {
|
|
849
1172
|
val options = theta.getMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
|
|
@@ -867,6 +1190,11 @@ class ThetaClientReactNativeModule(
|
|
|
867
1190
|
*/
|
|
868
1191
|
@ReactMethod
|
|
869
1192
|
fun getMySettingFromOldModel(optionNames: ReadableArray, promise: Promise) {
|
|
1193
|
+
val theta = theta
|
|
1194
|
+
if (theta == null) {
|
|
1195
|
+
promise.reject(Exception(messageNotInit))
|
|
1196
|
+
return
|
|
1197
|
+
}
|
|
870
1198
|
launch {
|
|
871
1199
|
try {
|
|
872
1200
|
val optionNameList = mutableListOf<ThetaRepository.OptionNameEnum>()
|
|
@@ -896,6 +1224,11 @@ class ThetaClientReactNativeModule(
|
|
|
896
1224
|
*/
|
|
897
1225
|
@ReactMethod
|
|
898
1226
|
fun setMySetting(captureMode: String, options: ReadableMap, promise: Promise) {
|
|
1227
|
+
val theta = theta
|
|
1228
|
+
if (theta == null) {
|
|
1229
|
+
promise.reject(Exception(messageNotInit))
|
|
1230
|
+
return
|
|
1231
|
+
}
|
|
899
1232
|
launch {
|
|
900
1233
|
try {
|
|
901
1234
|
val thetaOptions = ThetaRepository.Options()
|
|
@@ -920,6 +1253,11 @@ class ThetaClientReactNativeModule(
|
|
|
920
1253
|
*/
|
|
921
1254
|
@ReactMethod
|
|
922
1255
|
fun deleteMySetting(captureMode: String, promise: Promise) {
|
|
1256
|
+
val theta = theta
|
|
1257
|
+
if (theta == null) {
|
|
1258
|
+
promise.reject(Exception(messageNotInit))
|
|
1259
|
+
return
|
|
1260
|
+
}
|
|
923
1261
|
launch {
|
|
924
1262
|
try {
|
|
925
1263
|
theta.deleteMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
|
|
@@ -936,6 +1274,11 @@ class ThetaClientReactNativeModule(
|
|
|
936
1274
|
*/
|
|
937
1275
|
@ReactMethod
|
|
938
1276
|
fun listPlugins(promise: Promise) {
|
|
1277
|
+
val theta = theta
|
|
1278
|
+
if (theta == null) {
|
|
1279
|
+
promise.reject(Exception(messageNotInit))
|
|
1280
|
+
return
|
|
1281
|
+
}
|
|
939
1282
|
launch {
|
|
940
1283
|
try {
|
|
941
1284
|
val result = Arguments.createArray()
|
|
@@ -967,6 +1310,11 @@ class ThetaClientReactNativeModule(
|
|
|
967
1310
|
*/
|
|
968
1311
|
@ReactMethod
|
|
969
1312
|
fun setPlugin(packageName: String, promise: Promise) {
|
|
1313
|
+
val theta = theta
|
|
1314
|
+
if (theta == null) {
|
|
1315
|
+
promise.reject(Exception(messageNotInit))
|
|
1316
|
+
return
|
|
1317
|
+
}
|
|
970
1318
|
launch {
|
|
971
1319
|
try {
|
|
972
1320
|
theta.setPlugin(packageName)
|
|
@@ -984,6 +1332,11 @@ class ThetaClientReactNativeModule(
|
|
|
984
1332
|
*/
|
|
985
1333
|
@ReactMethod
|
|
986
1334
|
fun startPlugin(packageName: String, promise: Promise) {
|
|
1335
|
+
val theta = theta
|
|
1336
|
+
if (theta == null) {
|
|
1337
|
+
promise.reject(Exception(messageNotInit))
|
|
1338
|
+
return
|
|
1339
|
+
}
|
|
987
1340
|
launch {
|
|
988
1341
|
try {
|
|
989
1342
|
theta.startPlugin(packageName)
|
|
@@ -1000,6 +1353,11 @@ class ThetaClientReactNativeModule(
|
|
|
1000
1353
|
*/
|
|
1001
1354
|
@ReactMethod
|
|
1002
1355
|
fun stopPlugin(promise: Promise) {
|
|
1356
|
+
val theta = theta
|
|
1357
|
+
if (theta == null) {
|
|
1358
|
+
promise.reject(Exception(messageNotInit))
|
|
1359
|
+
return
|
|
1360
|
+
}
|
|
1003
1361
|
launch {
|
|
1004
1362
|
try {
|
|
1005
1363
|
theta.stopPlugin()
|
|
@@ -1017,6 +1375,11 @@ class ThetaClientReactNativeModule(
|
|
|
1017
1375
|
*/
|
|
1018
1376
|
@ReactMethod
|
|
1019
1377
|
fun getPluginLicense(packageName: String, promise: Promise) {
|
|
1378
|
+
val theta = theta
|
|
1379
|
+
if (theta == null) {
|
|
1380
|
+
promise.reject(Exception(messageNotInit))
|
|
1381
|
+
return
|
|
1382
|
+
}
|
|
1020
1383
|
launch {
|
|
1021
1384
|
try {
|
|
1022
1385
|
val result = theta.getPluginLicense(packageName)
|
|
@@ -1033,6 +1396,11 @@ class ThetaClientReactNativeModule(
|
|
|
1033
1396
|
*/
|
|
1034
1397
|
@ReactMethod
|
|
1035
1398
|
fun getPluginOrders(promise: Promise) {
|
|
1399
|
+
val theta = theta
|
|
1400
|
+
if (theta == null) {
|
|
1401
|
+
promise.reject(Exception(messageNotInit))
|
|
1402
|
+
return
|
|
1403
|
+
}
|
|
1036
1404
|
launch {
|
|
1037
1405
|
try {
|
|
1038
1406
|
val result = theta.getPluginOrders()
|
|
@@ -1054,6 +1422,11 @@ class ThetaClientReactNativeModule(
|
|
|
1054
1422
|
*/
|
|
1055
1423
|
@ReactMethod
|
|
1056
1424
|
fun setPluginOrders(plugins: ReadableArray, promise: Promise) {
|
|
1425
|
+
val theta = theta
|
|
1426
|
+
if (theta == null) {
|
|
1427
|
+
promise.reject(Exception(messageNotInit))
|
|
1428
|
+
return
|
|
1429
|
+
}
|
|
1057
1430
|
launch {
|
|
1058
1431
|
try {
|
|
1059
1432
|
val pluginList = mutableListOf<String>()
|
|
@@ -1066,11 +1439,12 @@ class ThetaClientReactNativeModule(
|
|
|
1066
1439
|
} catch (t: Throwable) {
|
|
1067
1440
|
promise.reject(t)
|
|
1068
1441
|
}
|
|
1069
|
-
}
|
|
1070
1442
|
}
|
|
1443
|
+
}
|
|
1071
1444
|
|
|
1072
1445
|
companion object {
|
|
1073
1446
|
const val NAME = "ThetaClientReactNative"
|
|
1074
1447
|
const val EVENT_NAME = "ThetaFrameEvent"
|
|
1448
|
+
const val EVENT_NOTIFY = "ThetaNotify"
|
|
1075
1449
|
}
|
|
1076
1450
|
}
|