theta-client-react-native 1.0.2 → 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/README.md +6 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +409 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +700 -24
- package/ios/ThetaClientReactNative.h +6 -0
- package/ios/ThetaClientReactNative.mm +1661 -183
- package/lib/commonjs/capture/capture.js +118 -0
- package/lib/commonjs/capture/capture.js.map +1 -0
- package/lib/commonjs/capture/index.js +50 -0
- package/lib/commonjs/capture/index.js.map +1 -0
- package/lib/commonjs/capture/notify.js +12 -0
- package/lib/commonjs/capture/notify.js.map +1 -0
- package/lib/commonjs/capture/photo-capture.js +64 -0
- package/lib/commonjs/capture/photo-capture.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/capture/video-capture.js +71 -0
- package/lib/commonjs/capture/video-capture.js.map +1 -0
- package/lib/commonjs/index.js +40 -1041
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theta-repository/access-point.js +23 -0
- package/lib/commonjs/theta-repository/access-point.js.map +1 -0
- 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 +105 -0
- package/lib/commonjs/theta-repository/index.js.map +1 -0
- package/lib/commonjs/theta-repository/options/index.js +138 -0
- package/lib/commonjs/theta-repository/options/index.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-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-white-balance-auto-strength.js +25 -0
- package/lib/commonjs/theta-repository/options/option-white-balance-auto-strength.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 +490 -0
- package/lib/commonjs/theta-repository/options/options.js.map +1 -0
- 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 +35 -0
- package/lib/commonjs/theta-repository/theta-files.js.map +1 -0
- package/lib/commonjs/theta-repository/theta-info.js +2 -0
- package/lib/commonjs/theta-repository/theta-info.js.map +1 -0
- package/lib/commonjs/theta-repository/theta-meta.js +2 -0
- package/lib/commonjs/theta-repository/theta-meta.js.map +1 -0
- package/lib/commonjs/theta-repository/theta-plugin.js +2 -0
- package/lib/commonjs/theta-repository/theta-plugin.js.map +1 -0
- package/lib/commonjs/theta-repository/theta-repository.js +510 -0
- package/lib/commonjs/theta-repository/theta-repository.js.map +1 -0
- package/lib/commonjs/theta-repository/theta-state.js +120 -0
- package/lib/commonjs/theta-repository/theta-state.js.map +1 -0
- 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/capture.js +111 -0
- package/lib/module/capture/capture.js.map +1 -0
- package/lib/module/capture/index.js +5 -0
- package/lib/module/capture/index.js.map +1 -0
- package/lib/module/capture/notify.js +6 -0
- package/lib/module/capture/notify.js.map +1 -0
- package/lib/module/capture/photo-capture.js +56 -0
- package/lib/module/capture/photo-capture.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/capture/video-capture.js +63 -0
- package/lib/module/capture/video-capture.js.map +1 -0
- package/lib/module/index.js +3 -1009
- package/lib/module/index.js.map +1 -1
- package/lib/module/theta-repository/access-point.js +16 -0
- package/lib/module/theta-repository/access-point.js.map +1 -0
- 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 +10 -0
- package/lib/module/theta-repository/index.js.map +1 -0
- package/lib/module/theta-repository/options/index.js +13 -0
- package/lib/module/theta-repository/options/index.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-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-white-balance-auto-strength.js +18 -0
- package/lib/module/theta-repository/options/option-white-balance-auto-strength.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 +482 -0
- package/lib/module/theta-repository/options/options.js.map +1 -0
- 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 +28 -0
- package/lib/module/theta-repository/theta-files.js.map +1 -0
- package/lib/module/theta-repository/theta-info.js +2 -0
- package/lib/module/theta-repository/theta-info.js.map +1 -0
- package/lib/module/theta-repository/theta-meta.js +2 -0
- package/lib/module/theta-repository/theta-meta.js.map +1 -0
- package/lib/module/theta-repository/theta-plugin.js +2 -0
- package/lib/module/theta-repository/theta-plugin.js.map +1 -0
- package/lib/module/theta-repository/theta-repository.js +466 -0
- package/lib/module/theta-repository/theta-repository.js.map +1 -0
- package/lib/module/theta-repository/theta-state.js +113 -0
- package/lib/module/theta-repository/theta-state.js.map +1 -0
- 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 +71 -0
- package/lib/typescript/capture/capture.d.ts.map +1 -0
- package/lib/typescript/capture/index.d.ts +5 -0
- package/lib/typescript/capture/index.d.ts.map +1 -0
- package/lib/typescript/capture/notify.d.ts +13 -0
- package/lib/typescript/capture/notify.d.ts.map +1 -0
- package/lib/typescript/capture/photo-capture.d.ts +38 -0
- package/lib/typescript/capture/photo-capture.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/capture/video-capture.d.ts +43 -0
- package/lib/typescript/capture/video-capture.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -972
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/theta-repository/access-point.d.ts +36 -0
- package/lib/typescript/theta-repository/access-point.d.ts.map +1 -0
- 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 +10 -0
- package/lib/typescript/theta-repository/index.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/index.d.ts +13 -0
- package/lib/typescript/theta-repository/options/index.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-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 +18 -0
- package/lib/typescript/theta-repository/options/option-white-balance-auto-strength.d.ts.map +1 -0
- 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 +566 -0
- package/lib/typescript/theta-repository/options/options.d.ts.map +1 -0
- 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 +45 -0
- package/lib/typescript/theta-repository/theta-files.d.ts.map +1 -0
- package/lib/typescript/theta-repository/theta-info.d.ts +34 -0
- package/lib/typescript/theta-repository/theta-info.d.ts.map +1 -0
- package/lib/typescript/theta-repository/theta-meta.d.ts +38 -0
- package/lib/typescript/theta-repository/theta-meta.d.ts.map +1 -0
- package/lib/typescript/theta-repository/theta-plugin.d.ts +26 -0
- package/lib/typescript/theta-repository/theta-plugin.d.ts.map +1 -0
- package/lib/typescript/theta-repository/theta-repository.d.ts +333 -0
- package/lib/typescript/theta-repository/theta-repository.d.ts.map +1 -0
- package/lib/typescript/theta-repository/theta-state.d.ts +150 -0
- package/lib/typescript/theta-repository/theta-state.d.ts.map +1 -0
- 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 +124 -0
- package/src/capture/index.ts +4 -0
- package/src/capture/notify.ts +27 -0
- package/src/capture/photo-capture.ts +62 -0
- package/src/capture/time-shift-capture.ts +99 -0
- package/src/capture/video-capture.ts +69 -0
- package/src/index.tsx +3 -1243
- package/src/theta-repository/access-point.ts +38 -0
- package/src/theta-repository/digest-auth.ts +16 -0
- package/src/theta-repository/index.ts +9 -0
- package/src/theta-repository/options/index.ts +13 -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 +19 -0
- package/src/theta-repository/options/option-wlan-frequency.ts +16 -0
- package/src/theta-repository/options/options.ts +622 -0
- package/src/theta-repository/theta-config.ts +20 -0
- package/src/theta-repository/theta-files.ts +49 -0
- package/src/theta-repository/theta-info.ts +35 -0
- package/src/theta-repository/theta-meta.ts +39 -0
- package/src/theta-repository/theta-plugin.ts +25 -0
- package/src/theta-repository/theta-repository.ts +527 -0
- package/src/theta-repository/theta-state.ts +164 -0
- 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,22 +98,50 @@ 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()
|
|
87
124
|
val result = Arguments.createMap()
|
|
125
|
+
result.putString("manufacturer", info.manufacturer)
|
|
88
126
|
result.putString("model", info.model)
|
|
89
127
|
result.putString("serialNumber", info.serialNumber)
|
|
128
|
+
info.wlanMacAddress?.also {
|
|
129
|
+
result.putString("wlanMacAddress", info.wlanMacAddress)
|
|
130
|
+
} ?: result.putNull("wlanMacAddress")
|
|
131
|
+
info.bluetoothMacAddress?.also {
|
|
132
|
+
result.putString("bluetoothMacAddress", info.bluetoothMacAddress)
|
|
133
|
+
} ?: result.putNull("bluetoothMacAddress")
|
|
90
134
|
result.putString("firmwareVersion", info.firmwareVersion)
|
|
135
|
+
result.putString("supportUrl", info.supportUrl)
|
|
91
136
|
result.putBoolean("hasGps", info.hasGps)
|
|
92
137
|
result.putBoolean("hasGyro", info.hasGyro)
|
|
93
138
|
result.putInt("uptime", info.uptime)
|
|
139
|
+
result.putArray("api", Arguments.fromList(info.api))
|
|
140
|
+
val ep = Arguments.createMap()
|
|
141
|
+
ep.putInt("httpPort", info.endpoints.httpPort)
|
|
142
|
+
ep.putInt("httpUpdatesPort", info.endpoints.httpUpdatesPort)
|
|
143
|
+
result.putMap("endpoints", ep)
|
|
144
|
+
result.putArray("apiLevel", Arguments.fromList(info.apiLevel))
|
|
94
145
|
promise.resolve(result)
|
|
95
146
|
} catch (t: Throwable) {
|
|
96
147
|
promise.reject(t)
|
|
@@ -104,17 +155,51 @@ class ThetaClientReactNativeModule(
|
|
|
104
155
|
*/
|
|
105
156
|
@ReactMethod
|
|
106
157
|
fun getThetaState(promise: Promise) {
|
|
158
|
+
val theta = theta
|
|
159
|
+
if (theta == null) {
|
|
160
|
+
promise.reject(Exception(messageNotInit))
|
|
161
|
+
return
|
|
162
|
+
}
|
|
107
163
|
launch {
|
|
108
164
|
try {
|
|
109
165
|
val state = theta.getThetaState()
|
|
110
166
|
val result = Arguments.createMap()
|
|
111
167
|
result.putString("fingerprint", state.fingerprint)
|
|
112
168
|
result.putDouble("batteryLevel", state.batteryLevel.toDouble())
|
|
113
|
-
result.putString("
|
|
114
|
-
result.
|
|
169
|
+
result.putString("storageUri", state.storageUri)
|
|
170
|
+
result.putString("storageID", state.storageID)
|
|
171
|
+
result.putString("captureStatus", state.captureStatus.toString())
|
|
115
172
|
result.putInt("recordedTime", state.recordedTime)
|
|
116
173
|
result.putInt("recordableTime", state.recordableTime)
|
|
174
|
+
state.capturedPictures?.also {
|
|
175
|
+
result.putInt("capturedPictures", state.capturedPictures!!)
|
|
176
|
+
} ?: result.putNull("capturedPictures")
|
|
177
|
+
state.compositeShootingElapsedTime?.also {
|
|
178
|
+
result.putString("compositeShootingElapsedTime", state.compositeShootingElapsedTime.toString())
|
|
179
|
+
} ?: result.putNull("compositeShootingElapsedTime")
|
|
117
180
|
result.putString("latestFileUrl", state.latestFileUrl)
|
|
181
|
+
result.putString("chargingState", state.chargingState.toString())
|
|
182
|
+
result.putInt("apiVersion", state.apiVersion)
|
|
183
|
+
state.isPluginRunning?.also {
|
|
184
|
+
result.putBoolean("isPluginRunning", state.isPluginRunning!!)
|
|
185
|
+
} ?: result.putNull("isPluginRunning")
|
|
186
|
+
state.isPluginWebServer?.also {
|
|
187
|
+
result.putBoolean("isPluginWebServer", state.isPluginWebServer!!)
|
|
188
|
+
} ?: result.putNull("isPluginWebServer")
|
|
189
|
+
state.function?.also {
|
|
190
|
+
result.putString("function", state.function.toString())
|
|
191
|
+
} ?: result.putNull("function")
|
|
192
|
+
state.isMySettingChanged?.also {
|
|
193
|
+
result.putBoolean("isMySettingChanged", state.isMySettingChanged!!)
|
|
194
|
+
} ?: result.putNull("isMySettingChanged")
|
|
195
|
+
result.putString("currentMicrophone", state.currentMicrophone?.toString())
|
|
196
|
+
result.putBoolean("isSdCard", state.isSdCard)
|
|
197
|
+
state.cameraError?.also {
|
|
198
|
+
result.putArray("cameraError", Arguments.makeNativeArray(state.cameraError!!.map { it.toString() }))
|
|
199
|
+
} ?: result.putNull("cameraError")
|
|
200
|
+
state.isBatteryInsert?.also {
|
|
201
|
+
result.putString("isBatteryInsert", state.isBatteryInsert.toString())
|
|
202
|
+
} ?: result.putNull("isBatteryInsert")
|
|
118
203
|
promise.resolve(result)
|
|
119
204
|
} catch (t: Throwable) {
|
|
120
205
|
promise.reject(t)
|
|
@@ -127,28 +212,41 @@ class ThetaClientReactNativeModule(
|
|
|
127
212
|
* @param fileType file type to retrieve
|
|
128
213
|
* @param startPosition start position to retrieve
|
|
129
214
|
* @param entryCount count to retrieve
|
|
215
|
+
* @param storage Desired storage
|
|
130
216
|
* @param promise promise to set result
|
|
131
217
|
*/
|
|
132
218
|
@ReactMethod
|
|
133
|
-
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
|
+
}
|
|
134
225
|
launch {
|
|
135
226
|
try {
|
|
136
|
-
val
|
|
227
|
+
val (fileList, totalEntries) = theta.listFiles(
|
|
137
228
|
ThetaRepository.FileTypeEnum.valueOf(fileType),
|
|
138
229
|
startPosition,
|
|
139
|
-
entryCount
|
|
230
|
+
entryCount,
|
|
231
|
+
storage?.let { ThetaRepository.StorageEnum.valueOf(it) },
|
|
140
232
|
)
|
|
141
233
|
val resultlist = Arguments.createArray()
|
|
142
|
-
|
|
234
|
+
fileList.forEach {
|
|
143
235
|
val result = Arguments.createMap()
|
|
144
236
|
result.putString("name", it.name)
|
|
145
237
|
result.putDouble("size", it.size.toDouble())
|
|
146
238
|
result.putString("dateTime", it.dateTime)
|
|
147
239
|
result.putString("thumbnailUrl", it.thumbnailUrl)
|
|
148
240
|
result.putString("fileUrl", it.fileUrl)
|
|
241
|
+
it.storageID?.run {
|
|
242
|
+
result.putString("storageID", this)
|
|
243
|
+
}
|
|
149
244
|
resultlist.pushMap(result)
|
|
150
245
|
}
|
|
151
|
-
|
|
246
|
+
val resultmap = Arguments.createMap()
|
|
247
|
+
resultmap.putArray("fileList", resultlist)
|
|
248
|
+
resultmap.putInt("totalEntries", totalEntries)
|
|
249
|
+
promise.resolve(resultmap)
|
|
152
250
|
} catch (t: Throwable) {
|
|
153
251
|
promise.reject(t)
|
|
154
252
|
}
|
|
@@ -162,6 +260,11 @@ class ThetaClientReactNativeModule(
|
|
|
162
260
|
*/
|
|
163
261
|
@ReactMethod
|
|
164
262
|
fun deleteFiles(fileUrls: ReadableArray, promise: Promise) {
|
|
263
|
+
val theta = theta
|
|
264
|
+
if (theta == null) {
|
|
265
|
+
promise.reject(Exception(messageNotInit))
|
|
266
|
+
return
|
|
267
|
+
}
|
|
165
268
|
val fileList = mutableListOf<String>()
|
|
166
269
|
for (index in 0..(fileUrls.size() - 1)) {
|
|
167
270
|
fileList.add(fileUrls.getString(index))
|
|
@@ -182,6 +285,11 @@ class ThetaClientReactNativeModule(
|
|
|
182
285
|
*/
|
|
183
286
|
@ReactMethod
|
|
184
287
|
fun deleteAllFiles(promise: Promise) {
|
|
288
|
+
val theta = theta
|
|
289
|
+
if (theta == null) {
|
|
290
|
+
promise.reject(Exception(messageNotInit))
|
|
291
|
+
return
|
|
292
|
+
}
|
|
185
293
|
launch {
|
|
186
294
|
try {
|
|
187
295
|
theta.deleteAllFiles()
|
|
@@ -198,6 +306,11 @@ class ThetaClientReactNativeModule(
|
|
|
198
306
|
*/
|
|
199
307
|
@ReactMethod
|
|
200
308
|
fun deleteAllImageFiles(promise: Promise) {
|
|
309
|
+
val theta = theta
|
|
310
|
+
if (theta == null) {
|
|
311
|
+
promise.reject(Exception(messageNotInit))
|
|
312
|
+
return
|
|
313
|
+
}
|
|
201
314
|
launch {
|
|
202
315
|
try {
|
|
203
316
|
theta.deleteAllImageFiles()
|
|
@@ -214,6 +327,11 @@ class ThetaClientReactNativeModule(
|
|
|
214
327
|
*/
|
|
215
328
|
@ReactMethod
|
|
216
329
|
fun deleteAllVideoFiles(promise: Promise) {
|
|
330
|
+
val theta = theta
|
|
331
|
+
if (theta == null) {
|
|
332
|
+
promise.reject(Exception(messageNotInit))
|
|
333
|
+
return
|
|
334
|
+
}
|
|
217
335
|
launch {
|
|
218
336
|
try {
|
|
219
337
|
theta.deleteAllVideoFiles()
|
|
@@ -227,6 +345,9 @@ class ThetaClientReactNativeModule(
|
|
|
227
345
|
/** option converter */
|
|
228
346
|
private val converters = mapOf(
|
|
229
347
|
"aperture" to ApertureConverter(),
|
|
348
|
+
"bluetoothPower" to BluetoothPowerConverter(),
|
|
349
|
+
"cameraControlSource" to CameraControlSourceConverter(),
|
|
350
|
+
"cameraMode" to CameraModeConverter(),
|
|
230
351
|
"captureMode" to CaptureModeConverter(),
|
|
231
352
|
"colorTemperature" to ColorTemperatureConverter(),
|
|
232
353
|
"dateTimeZone" to DateTimeZoneConverter(),
|
|
@@ -241,20 +362,34 @@ class ThetaClientReactNativeModule(
|
|
|
241
362
|
"isoAutoHighLimit" to IsoAutoHighLimitConverter(),
|
|
242
363
|
"language" to LanguageConverter(),
|
|
243
364
|
"maxRecordableTime" to MaxRecordableTimeConverter(),
|
|
365
|
+
"networkType" to NetworkTypeConverter(),
|
|
244
366
|
"offDelay" to OffDelayConverter(),
|
|
245
|
-
"
|
|
367
|
+
"password" to PasswordConverter(),
|
|
368
|
+
"powerSaving" to PowerSavingConverter(),
|
|
369
|
+
"previewFormat" to PreviewFormatConverter(),
|
|
370
|
+
"proxy" to ProxyConverter(),
|
|
246
371
|
"remainingPictures" to RemainingPicturesConverter(),
|
|
247
372
|
"remainingVideoSeconds" to RemainingVideoSecondsConverter(),
|
|
248
373
|
"remainingSpace" to RemainingSpaceConverter(),
|
|
249
|
-
"
|
|
374
|
+
"shootingMethod" to ShootingMethodConverter(),
|
|
375
|
+
"shutterSpeed" to ShutterSpeedConverter(),
|
|
250
376
|
"shutterVolume" to ShutterVolumeConverter(),
|
|
377
|
+
"sleepDelay" to SleepDelayConverter(),
|
|
378
|
+
"timeShift" to TimeShiftConverter(),
|
|
379
|
+
"totalSpace" to TotalSpaceConverter(),
|
|
380
|
+
"username" to UsernameConverter(),
|
|
251
381
|
"whiteBalance" to WhiteBalanceConverter(),
|
|
382
|
+
"whiteBalanceAutoStrength" to WhiteBalanceAutoStrengthConverter(),
|
|
383
|
+
"wlanFrequency" to WlanFrequencyConverter(),
|
|
252
384
|
"_gpsTagRecording" to GpsTagRecordingConverter(),
|
|
253
385
|
)
|
|
386
|
+
|
|
254
387
|
/** OptionNameEnum to option */
|
|
255
388
|
private val optionEnumToOption = mapOf(
|
|
256
389
|
"Aperture" to "aperture",
|
|
257
|
-
"
|
|
390
|
+
"BluetoothPower" to "bluetoothPower",
|
|
391
|
+
"CameraControlSource" to "cameraControlSource",
|
|
392
|
+
"CameraMode" to "cameraMode",
|
|
258
393
|
"CaptureMode" to "captureMode",
|
|
259
394
|
"ColorTemperature" to "colorTemperature",
|
|
260
395
|
"DateTimeZone" to "dateTimeZone",
|
|
@@ -269,14 +404,25 @@ class ThetaClientReactNativeModule(
|
|
|
269
404
|
"IsoAutoHighLimit" to "isoAutoHighLimit",
|
|
270
405
|
"Language" to "language",
|
|
271
406
|
"MaxRecordableTime" to "maxRecordableTime",
|
|
407
|
+
"NetworkType" to "networkType",
|
|
272
408
|
"OffDelay" to "offDelay",
|
|
273
|
-
"
|
|
409
|
+
"Password" to "password",
|
|
410
|
+
"PowerSaving" to "powerSaving",
|
|
411
|
+
"PreviewFormat" to "previewFormat",
|
|
412
|
+
"Proxy" to "proxy",
|
|
274
413
|
"RemainingPictures" to "remainingPictures",
|
|
275
414
|
"RemainingVideoSeconds" to "remainingVideoSeconds",
|
|
276
415
|
"RemainingSpace" to "remainingSpace",
|
|
277
|
-
"
|
|
416
|
+
"ShootingMethod" to "shootingMethod",
|
|
417
|
+
"ShutterSpeed" to "shutterSpeed",
|
|
278
418
|
"ShutterVolume" to "shutterVolume",
|
|
419
|
+
"SleepDelay" to "sleepDelay",
|
|
420
|
+
"TimeShift" to "timeShift",
|
|
421
|
+
"TotalSpace" to "totalSpace",
|
|
422
|
+
"Username" to "username",
|
|
279
423
|
"WhiteBalance" to "whiteBalance",
|
|
424
|
+
"WhiteBalanceAutoStrength" to "whiteBalanceAutoStrength",
|
|
425
|
+
"WlanFrequency" to "wlanFrequency",
|
|
280
426
|
)
|
|
281
427
|
|
|
282
428
|
/**
|
|
@@ -286,6 +432,11 @@ class ThetaClientReactNativeModule(
|
|
|
286
432
|
*/
|
|
287
433
|
@ReactMethod
|
|
288
434
|
fun getOptions(optionNames: ReadableArray, promise: Promise) {
|
|
435
|
+
val theta = theta
|
|
436
|
+
if (theta == null) {
|
|
437
|
+
promise.reject(Exception(messageNotInit))
|
|
438
|
+
return
|
|
439
|
+
}
|
|
289
440
|
launch {
|
|
290
441
|
try {
|
|
291
442
|
val optionNameList = mutableListOf<ThetaRepository.OptionNameEnum>()
|
|
@@ -315,6 +466,11 @@ class ThetaClientReactNativeModule(
|
|
|
315
466
|
*/
|
|
316
467
|
@ReactMethod
|
|
317
468
|
fun setOptions(options: ReadableMap, promise: Promise) {
|
|
469
|
+
val theta = theta
|
|
470
|
+
if (theta == null) {
|
|
471
|
+
promise.reject(Exception(messageNotInit))
|
|
472
|
+
return
|
|
473
|
+
}
|
|
318
474
|
launch {
|
|
319
475
|
try {
|
|
320
476
|
val thetaOptions = ThetaRepository.Options()
|
|
@@ -338,15 +494,22 @@ class ThetaClientReactNativeModule(
|
|
|
338
494
|
*/
|
|
339
495
|
@ReactMethod
|
|
340
496
|
fun getLivePreview(promise: Promise) {
|
|
497
|
+
val theta = theta
|
|
498
|
+
if (theta == null) {
|
|
499
|
+
promise.reject(Exception(messageNotInit))
|
|
500
|
+
return
|
|
501
|
+
}
|
|
341
502
|
fun ByteArray.toBase64(): String = String(Base64.getEncoder().encode(this))
|
|
342
503
|
suspend fun callFrameHandler(packet: Pair<ByteArray, Int>): Boolean {
|
|
343
504
|
if (listenerCount == 0) {
|
|
344
505
|
return previewing
|
|
345
506
|
}
|
|
346
507
|
val param = Arguments.createMap()
|
|
347
|
-
param.putString(
|
|
348
|
-
|
|
349
|
-
|
|
508
|
+
param.putString(
|
|
509
|
+
"data",
|
|
510
|
+
"data:image/jpeg;base64," +
|
|
511
|
+
packet.first.copyOfRange(0, packet.second).toBase64()
|
|
512
|
+
)
|
|
350
513
|
reactApplicationContext
|
|
351
514
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
352
515
|
.emit(EVENT_NAME, param)
|
|
@@ -368,6 +531,9 @@ class ThetaClientReactNativeModule(
|
|
|
368
531
|
*/
|
|
369
532
|
@ReactMethod
|
|
370
533
|
fun stopLivePreview() {
|
|
534
|
+
if (theta == null) {
|
|
535
|
+
throw Exception(messageNotInit)
|
|
536
|
+
}
|
|
371
537
|
previewing = false
|
|
372
538
|
}
|
|
373
539
|
|
|
@@ -376,6 +542,7 @@ class ThetaClientReactNativeModule(
|
|
|
376
542
|
*/
|
|
377
543
|
@ReactMethod
|
|
378
544
|
fun getPhotoCaptureBuilder() {
|
|
545
|
+
val theta = theta ?: throw Exception(messageNotInit)
|
|
379
546
|
photoCaptureBuilder = theta.getPhotoCaptureBuilder()
|
|
380
547
|
}
|
|
381
548
|
|
|
@@ -387,6 +554,9 @@ class ThetaClientReactNativeModule(
|
|
|
387
554
|
*/
|
|
388
555
|
@ReactMethod
|
|
389
556
|
fun buildPhotoCapture(options: ReadableMap, promise: Promise) {
|
|
557
|
+
if (theta == null) {
|
|
558
|
+
throw Exception(messageNotInit)
|
|
559
|
+
}
|
|
390
560
|
if (photoCaptureBuilder == null) {
|
|
391
561
|
promise.reject(Exception("no photoCaptureBuilder"))
|
|
392
562
|
return
|
|
@@ -415,6 +585,10 @@ class ThetaClientReactNativeModule(
|
|
|
415
585
|
*/
|
|
416
586
|
@ReactMethod
|
|
417
587
|
fun takePicture(promise: Promise) {
|
|
588
|
+
if (theta == null) {
|
|
589
|
+
promise.reject(Exception(messageNotInit))
|
|
590
|
+
return
|
|
591
|
+
}
|
|
418
592
|
if (photoCapture == null) {
|
|
419
593
|
promise.reject(Exception("no photoCapture"))
|
|
420
594
|
return
|
|
@@ -435,11 +609,107 @@ class ThetaClientReactNativeModule(
|
|
|
435
609
|
}
|
|
436
610
|
}
|
|
437
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
|
+
|
|
438
707
|
/**
|
|
439
708
|
* getVideoCaptureBuilder - get video capture builder
|
|
440
709
|
*/
|
|
441
710
|
@ReactMethod
|
|
442
711
|
fun getVideoCaptureBuilder() {
|
|
712
|
+
val theta = theta ?: throw Exception(messageNotInit)
|
|
443
713
|
videoCaptureBuilder = theta.getVideoCaptureBuilder()
|
|
444
714
|
}
|
|
445
715
|
|
|
@@ -450,6 +720,10 @@ class ThetaClientReactNativeModule(
|
|
|
450
720
|
*/
|
|
451
721
|
@ReactMethod
|
|
452
722
|
fun buildVideoCapture(options: ReadableMap, promise: Promise) {
|
|
723
|
+
if (theta == null) {
|
|
724
|
+
promise.reject(Exception(messageNotInit))
|
|
725
|
+
return
|
|
726
|
+
}
|
|
453
727
|
if (videoCaptureBuilder == null) {
|
|
454
728
|
promise.reject(Exception("no videoCaptureBuilder"))
|
|
455
729
|
return
|
|
@@ -478,6 +752,10 @@ class ThetaClientReactNativeModule(
|
|
|
478
752
|
*/
|
|
479
753
|
@ReactMethod
|
|
480
754
|
fun startCapture(promise: Promise) {
|
|
755
|
+
if (theta == null) {
|
|
756
|
+
promise.reject(Exception(messageNotInit))
|
|
757
|
+
return
|
|
758
|
+
}
|
|
481
759
|
if (videoCapture == null) {
|
|
482
760
|
promise.reject(Exception("no videoCapture"))
|
|
483
761
|
return
|
|
@@ -503,6 +781,9 @@ class ThetaClientReactNativeModule(
|
|
|
503
781
|
*/
|
|
504
782
|
@ReactMethod
|
|
505
783
|
fun stopCapture() {
|
|
784
|
+
if (theta == null) {
|
|
785
|
+
throw Exception(messageNotInit)
|
|
786
|
+
}
|
|
506
787
|
videoCapturing?.stopCapture()
|
|
507
788
|
}
|
|
508
789
|
|
|
@@ -512,6 +793,11 @@ class ThetaClientReactNativeModule(
|
|
|
512
793
|
*/
|
|
513
794
|
@ReactMethod
|
|
514
795
|
fun getMetadata(fileUrl: String, promise: Promise) {
|
|
796
|
+
val theta = theta
|
|
797
|
+
if (theta == null) {
|
|
798
|
+
promise.reject(Exception(messageNotInit))
|
|
799
|
+
return
|
|
800
|
+
}
|
|
515
801
|
launch {
|
|
516
802
|
try {
|
|
517
803
|
val metaData = theta.getMetadata(fileUrl)
|
|
@@ -546,6 +832,11 @@ class ThetaClientReactNativeModule(
|
|
|
546
832
|
*/
|
|
547
833
|
@ReactMethod
|
|
548
834
|
fun reset(promise: Promise) {
|
|
835
|
+
val theta = theta
|
|
836
|
+
if (theta == null) {
|
|
837
|
+
promise.reject(Exception(messageNotInit))
|
|
838
|
+
return
|
|
839
|
+
}
|
|
549
840
|
launch {
|
|
550
841
|
try {
|
|
551
842
|
theta.reset()
|
|
@@ -562,6 +853,11 @@ class ThetaClientReactNativeModule(
|
|
|
562
853
|
*/
|
|
563
854
|
@ReactMethod
|
|
564
855
|
fun restoreSettings(promise: Promise) {
|
|
856
|
+
val theta = theta
|
|
857
|
+
if (theta == null) {
|
|
858
|
+
promise.reject(Exception(messageNotInit))
|
|
859
|
+
return
|
|
860
|
+
}
|
|
565
861
|
launch {
|
|
566
862
|
try {
|
|
567
863
|
theta.restoreSettings()
|
|
@@ -578,6 +874,11 @@ class ThetaClientReactNativeModule(
|
|
|
578
874
|
*/
|
|
579
875
|
@ReactMethod
|
|
580
876
|
fun stopSelfTimer(promise: Promise) {
|
|
877
|
+
val theta = theta
|
|
878
|
+
if (theta == null) {
|
|
879
|
+
promise.reject(Exception(messageNotInit))
|
|
880
|
+
return
|
|
881
|
+
}
|
|
581
882
|
launch {
|
|
582
883
|
try {
|
|
583
884
|
theta.stopSelfTimer()
|
|
@@ -602,6 +903,11 @@ class ThetaClientReactNativeModule(
|
|
|
602
903
|
applyTopBottomCorrection: Boolean,
|
|
603
904
|
promise: Promise,
|
|
604
905
|
) {
|
|
906
|
+
val theta = theta
|
|
907
|
+
if (theta == null) {
|
|
908
|
+
promise.reject(Exception(messageNotInit))
|
|
909
|
+
return
|
|
910
|
+
}
|
|
605
911
|
launch {
|
|
606
912
|
try {
|
|
607
913
|
val convertedUrl = theta.convertVideoFormats(fileUrl, is4k, applyTopBottomCorrection)
|
|
@@ -619,6 +925,11 @@ class ThetaClientReactNativeModule(
|
|
|
619
925
|
*/
|
|
620
926
|
@ReactMethod
|
|
621
927
|
fun cancelVideoConvert(promise: Promise) {
|
|
928
|
+
val theta = theta
|
|
929
|
+
if (theta == null) {
|
|
930
|
+
promise.reject(Exception(messageNotInit))
|
|
931
|
+
return
|
|
932
|
+
}
|
|
622
933
|
launch {
|
|
623
934
|
try {
|
|
624
935
|
theta.cancelVideoConvert()
|
|
@@ -635,6 +946,11 @@ class ThetaClientReactNativeModule(
|
|
|
635
946
|
*/
|
|
636
947
|
@ReactMethod
|
|
637
948
|
fun finishWlan(promise: Promise) {
|
|
949
|
+
val theta = theta
|
|
950
|
+
if (theta == null) {
|
|
951
|
+
promise.reject(Exception(messageNotInit))
|
|
952
|
+
return
|
|
953
|
+
}
|
|
638
954
|
launch {
|
|
639
955
|
try {
|
|
640
956
|
theta.finishWlan()
|
|
@@ -651,6 +967,11 @@ class ThetaClientReactNativeModule(
|
|
|
651
967
|
*/
|
|
652
968
|
@ReactMethod
|
|
653
969
|
fun listAccessPoints(promise: Promise) {
|
|
970
|
+
val theta = theta
|
|
971
|
+
if (theta == null) {
|
|
972
|
+
promise.reject(Exception(messageNotInit))
|
|
973
|
+
return
|
|
974
|
+
}
|
|
654
975
|
launch {
|
|
655
976
|
try {
|
|
656
977
|
val result = Arguments.createArray()
|
|
@@ -664,6 +985,15 @@ class ThetaClientReactNativeModule(
|
|
|
664
985
|
apinfo.putString("ipAddress", it.ipAddress)
|
|
665
986
|
apinfo.putString("subnetMask", it.subnetMask)
|
|
666
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
|
+
|
|
667
997
|
result.pushMap(apinfo)
|
|
668
998
|
}
|
|
669
999
|
promise.resolve(result)
|
|
@@ -680,6 +1010,7 @@ class ThetaClientReactNativeModule(
|
|
|
680
1010
|
* @param authMode auth mode to connect
|
|
681
1011
|
* @param password password to connect with auth
|
|
682
1012
|
* @param connectionPriority connection priority
|
|
1013
|
+
* @param proxy Proxy information to be used for the access point.
|
|
683
1014
|
* @param promise promise to set result
|
|
684
1015
|
*/
|
|
685
1016
|
@ReactMethod
|
|
@@ -689,8 +1020,14 @@ class ThetaClientReactNativeModule(
|
|
|
689
1020
|
authMode: String,
|
|
690
1021
|
password: String,
|
|
691
1022
|
connectionPriority: Int,
|
|
1023
|
+
proxy: ReadableMap?,
|
|
692
1024
|
promise: Promise
|
|
693
1025
|
) {
|
|
1026
|
+
val theta = theta
|
|
1027
|
+
if (theta == null) {
|
|
1028
|
+
promise.reject(Exception(messageNotInit))
|
|
1029
|
+
return
|
|
1030
|
+
}
|
|
694
1031
|
launch {
|
|
695
1032
|
try {
|
|
696
1033
|
theta.setAccessPointDynamically(
|
|
@@ -698,7 +1035,8 @@ class ThetaClientReactNativeModule(
|
|
|
698
1035
|
ssidStealth,
|
|
699
1036
|
ThetaRepository.AuthModeEnum.valueOf(authMode),
|
|
700
1037
|
password,
|
|
701
|
-
connectionPriority
|
|
1038
|
+
connectionPriority,
|
|
1039
|
+
convertMapToProxy(proxyMap = proxy)
|
|
702
1040
|
)
|
|
703
1041
|
promise.resolve(true)
|
|
704
1042
|
} catch (t: Throwable) {
|
|
@@ -718,6 +1056,7 @@ class ThetaClientReactNativeModule(
|
|
|
718
1056
|
* @param subnetMask subnet mask for ip address
|
|
719
1057
|
* @param defaultGateway default gateway address
|
|
720
1058
|
* @param promise promise to set result
|
|
1059
|
+
* @param proxy Proxy information to be used for the access point.
|
|
721
1060
|
*/
|
|
722
1061
|
@ReactMethod
|
|
723
1062
|
fun setAccessPointStatically(
|
|
@@ -729,8 +1068,14 @@ class ThetaClientReactNativeModule(
|
|
|
729
1068
|
ipAddress: String,
|
|
730
1069
|
subnetMask: String,
|
|
731
1070
|
defaultGateway: String,
|
|
1071
|
+
proxy: ReadableMap?,
|
|
732
1072
|
promise: Promise
|
|
733
1073
|
) {
|
|
1074
|
+
val theta = theta
|
|
1075
|
+
if (theta == null) {
|
|
1076
|
+
promise.reject(Exception(messageNotInit))
|
|
1077
|
+
return
|
|
1078
|
+
}
|
|
734
1079
|
launch {
|
|
735
1080
|
try {
|
|
736
1081
|
theta.setAccessPointStatically(
|
|
@@ -742,6 +1087,7 @@ class ThetaClientReactNativeModule(
|
|
|
742
1087
|
ipAddress,
|
|
743
1088
|
subnetMask,
|
|
744
1089
|
defaultGateway,
|
|
1090
|
+
convertMapToProxy(proxyMap = proxy)
|
|
745
1091
|
)
|
|
746
1092
|
promise.resolve(true)
|
|
747
1093
|
} catch (t: Throwable) {
|
|
@@ -757,6 +1103,11 @@ class ThetaClientReactNativeModule(
|
|
|
757
1103
|
*/
|
|
758
1104
|
@ReactMethod
|
|
759
1105
|
fun deleteAccessPoint(ssid: String, promise: Promise) {
|
|
1106
|
+
val theta = theta
|
|
1107
|
+
if (theta == null) {
|
|
1108
|
+
promise.reject(Exception(messageNotInit))
|
|
1109
|
+
return
|
|
1110
|
+
}
|
|
760
1111
|
launch {
|
|
761
1112
|
try {
|
|
762
1113
|
theta.deleteAccessPoint(ssid)
|
|
@@ -767,8 +1118,333 @@ class ThetaClientReactNativeModule(
|
|
|
767
1118
|
}
|
|
768
1119
|
}
|
|
769
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
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* setBluetoothDevice - register uuid of a BLE device
|
|
1137
|
+
* @param uuid uuid to set
|
|
1138
|
+
* @param promise promise to set result
|
|
1139
|
+
*/
|
|
1140
|
+
@ReactMethod
|
|
1141
|
+
fun setBluetoothDevice(uuid: String, promise: Promise) {
|
|
1142
|
+
val theta = theta
|
|
1143
|
+
if (theta == null) {
|
|
1144
|
+
promise.reject(Exception(messageNotInit))
|
|
1145
|
+
return
|
|
1146
|
+
}
|
|
1147
|
+
launch {
|
|
1148
|
+
try {
|
|
1149
|
+
val deviceName = theta.setBluetoothDevice(uuid)
|
|
1150
|
+
promise.resolve(deviceName)
|
|
1151
|
+
} catch (t: Throwable) {
|
|
1152
|
+
promise.reject(t)
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* getMySetting - Acquires the shooting properties set by the camera._setMySetting command.
|
|
1159
|
+
* Just for Theta V and later
|
|
1160
|
+
* @param captureMode The target shooting mode
|
|
1161
|
+
* @param promise promise to set result
|
|
1162
|
+
*/
|
|
1163
|
+
@ReactMethod
|
|
1164
|
+
fun getMySetting(captureMode: String, promise: Promise) {
|
|
1165
|
+
val theta = theta
|
|
1166
|
+
if (theta == null) {
|
|
1167
|
+
promise.reject(Exception(messageNotInit))
|
|
1168
|
+
return
|
|
1169
|
+
}
|
|
1170
|
+
launch {
|
|
1171
|
+
try {
|
|
1172
|
+
val options = theta.getMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
|
|
1173
|
+
val result = Arguments.createMap()
|
|
1174
|
+
converters.forEach {
|
|
1175
|
+
val cvt = it.value
|
|
1176
|
+
cvt?.setFromTheta(options, result)
|
|
1177
|
+
}
|
|
1178
|
+
promise.resolve(result)
|
|
1179
|
+
} catch (t: Throwable) {
|
|
1180
|
+
promise.reject(t)
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* getMySettingFromOldModel - Acquires the shooting properties set by the camera._setMySetting command.
|
|
1187
|
+
* Just for Theta S and SC.
|
|
1188
|
+
* @param optionNames The target shooting mode
|
|
1189
|
+
* @param promise promise to set result
|
|
1190
|
+
*/
|
|
1191
|
+
@ReactMethod
|
|
1192
|
+
fun getMySettingFromOldModel(optionNames: ReadableArray, promise: Promise) {
|
|
1193
|
+
val theta = theta
|
|
1194
|
+
if (theta == null) {
|
|
1195
|
+
promise.reject(Exception(messageNotInit))
|
|
1196
|
+
return
|
|
1197
|
+
}
|
|
1198
|
+
launch {
|
|
1199
|
+
try {
|
|
1200
|
+
val optionNameList = mutableListOf<ThetaRepository.OptionNameEnum>()
|
|
1201
|
+
for (index in 0..(optionNames.size() - 1)) {
|
|
1202
|
+
val option = optionNames.getString(index)
|
|
1203
|
+
optionNameList.add(ThetaRepository.OptionNameEnum.valueOf(option))
|
|
1204
|
+
}
|
|
1205
|
+
val options = theta.getMySetting(optionNameList)
|
|
1206
|
+
val result = Arguments.createMap()
|
|
1207
|
+
for (index in 0..(optionNames.size() - 1)) {
|
|
1208
|
+
val option = optionEnumToOption[optionNames.getString(index)]
|
|
1209
|
+
val cvt = converters[option]
|
|
1210
|
+
cvt?.setFromTheta(options, result)
|
|
1211
|
+
}
|
|
1212
|
+
promise.resolve(result)
|
|
1213
|
+
} catch (t: Throwable) {
|
|
1214
|
+
promise.reject(t)
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* setMySetting - Registers shooting conditions in My Settings
|
|
1221
|
+
* @param captureMode The target shooting mode. RICOH THETA S and SC do not support My Settings in video capture mode.
|
|
1222
|
+
* @param options registered to My Settings
|
|
1223
|
+
* @param Promise of bolean result, always true
|
|
1224
|
+
*/
|
|
1225
|
+
@ReactMethod
|
|
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
|
+
}
|
|
1232
|
+
launch {
|
|
1233
|
+
try {
|
|
1234
|
+
val thetaOptions = ThetaRepository.Options()
|
|
1235
|
+
val iterator = options.keySetIterator()
|
|
1236
|
+
while (iterator.hasNextKey()) {
|
|
1237
|
+
val key = iterator.nextKey()
|
|
1238
|
+
val cvt = converters[key]
|
|
1239
|
+
cvt?.setToTheta(thetaOptions, options)
|
|
1240
|
+
}
|
|
1241
|
+
theta.setMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode), thetaOptions)
|
|
1242
|
+
promise.resolve(true)
|
|
1243
|
+
} catch (t: Throwable) {
|
|
1244
|
+
promise.reject(t)
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* deleteMySetting - Delete shooting conditions in My Settings. Supported just by Theta X and Z1.
|
|
1251
|
+
* @param captureMode The target shooting mode
|
|
1252
|
+
* @param promise promise to set result, always true
|
|
1253
|
+
*/
|
|
1254
|
+
@ReactMethod
|
|
1255
|
+
fun deleteMySetting(captureMode: String, promise: Promise) {
|
|
1256
|
+
val theta = theta
|
|
1257
|
+
if (theta == null) {
|
|
1258
|
+
promise.reject(Exception(messageNotInit))
|
|
1259
|
+
return
|
|
1260
|
+
}
|
|
1261
|
+
launch {
|
|
1262
|
+
try {
|
|
1263
|
+
theta.deleteMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
|
|
1264
|
+
promise.resolve(true)
|
|
1265
|
+
} catch (t: Throwable) {
|
|
1266
|
+
promise.reject(t)
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
/**
|
|
1272
|
+
* listPlugins - acquires a list of installed plugins
|
|
1273
|
+
* @param promise promise to set result
|
|
1274
|
+
*/
|
|
1275
|
+
@ReactMethod
|
|
1276
|
+
fun listPlugins(promise: Promise) {
|
|
1277
|
+
val theta = theta
|
|
1278
|
+
if (theta == null) {
|
|
1279
|
+
promise.reject(Exception(messageNotInit))
|
|
1280
|
+
return
|
|
1281
|
+
}
|
|
1282
|
+
launch {
|
|
1283
|
+
try {
|
|
1284
|
+
val result = Arguments.createArray()
|
|
1285
|
+
theta.listPlugins().forEach {
|
|
1286
|
+
val pinfo = Arguments.createMap()
|
|
1287
|
+
pinfo.putString("name", it.name)
|
|
1288
|
+
pinfo.putString("packageName", it.packageName)
|
|
1289
|
+
pinfo.putString("version", it.version)
|
|
1290
|
+
pinfo.putBoolean("isPreInstalled", it.isPreInstalled)
|
|
1291
|
+
pinfo.putBoolean("isRunning", it.isRunning)
|
|
1292
|
+
pinfo.putBoolean("isForeground", it.isForeground)
|
|
1293
|
+
pinfo.putBoolean("isBoot", it.isBoot)
|
|
1294
|
+
pinfo.putBoolean("hasWebServer", it.hasWebServer)
|
|
1295
|
+
pinfo.putString("exitStatus", it.exitStatus)
|
|
1296
|
+
pinfo.putString("message", it.message)
|
|
1297
|
+
result.pushMap(pinfo)
|
|
1298
|
+
}
|
|
1299
|
+
promise.resolve(result)
|
|
1300
|
+
} catch (t: Throwable) {
|
|
1301
|
+
promise.reject(t)
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* setPlugin - sets the installed plugin for boot. Supported just by Theta V.
|
|
1308
|
+
* @param packageName Package name of the target plugin.
|
|
1309
|
+
* @param promise promise to set result
|
|
1310
|
+
*/
|
|
1311
|
+
@ReactMethod
|
|
1312
|
+
fun setPlugin(packageName: String, promise: Promise) {
|
|
1313
|
+
val theta = theta
|
|
1314
|
+
if (theta == null) {
|
|
1315
|
+
promise.reject(Exception(messageNotInit))
|
|
1316
|
+
return
|
|
1317
|
+
}
|
|
1318
|
+
launch {
|
|
1319
|
+
try {
|
|
1320
|
+
theta.setPlugin(packageName)
|
|
1321
|
+
promise.resolve(true)
|
|
1322
|
+
} catch (t: Throwable) {
|
|
1323
|
+
promise.reject(t)
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* startPlugin - start the plugin specified by the [packageName].
|
|
1330
|
+
* @param packageName Package name of the target plugin.
|
|
1331
|
+
* @param promise promise to set result
|
|
1332
|
+
*/
|
|
1333
|
+
@ReactMethod
|
|
1334
|
+
fun startPlugin(packageName: String, promise: Promise) {
|
|
1335
|
+
val theta = theta
|
|
1336
|
+
if (theta == null) {
|
|
1337
|
+
promise.reject(Exception(messageNotInit))
|
|
1338
|
+
return
|
|
1339
|
+
}
|
|
1340
|
+
launch {
|
|
1341
|
+
try {
|
|
1342
|
+
theta.startPlugin(packageName)
|
|
1343
|
+
promise.resolve(true)
|
|
1344
|
+
} catch (t: Throwable) {
|
|
1345
|
+
promise.reject(t)
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* stopPlugin - Stop the running plugin.
|
|
1352
|
+
* @param promise promise to set result
|
|
1353
|
+
*/
|
|
1354
|
+
@ReactMethod
|
|
1355
|
+
fun stopPlugin(promise: Promise) {
|
|
1356
|
+
val theta = theta
|
|
1357
|
+
if (theta == null) {
|
|
1358
|
+
promise.reject(Exception(messageNotInit))
|
|
1359
|
+
return
|
|
1360
|
+
}
|
|
1361
|
+
launch {
|
|
1362
|
+
try {
|
|
1363
|
+
theta.stopPlugin()
|
|
1364
|
+
promise.resolve(true)
|
|
1365
|
+
} catch (t: Throwable) {
|
|
1366
|
+
promise.reject(t)
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* getPluginLicense - acquires the license for the installed plugin.
|
|
1373
|
+
* @param packageName Package name of the target plugin.
|
|
1374
|
+
* @param promise promise to set result
|
|
1375
|
+
*/
|
|
1376
|
+
@ReactMethod
|
|
1377
|
+
fun getPluginLicense(packageName: String, promise: Promise) {
|
|
1378
|
+
val theta = theta
|
|
1379
|
+
if (theta == null) {
|
|
1380
|
+
promise.reject(Exception(messageNotInit))
|
|
1381
|
+
return
|
|
1382
|
+
}
|
|
1383
|
+
launch {
|
|
1384
|
+
try {
|
|
1385
|
+
val result = theta.getPluginLicense(packageName)
|
|
1386
|
+
promise.resolve(result)
|
|
1387
|
+
} catch (t: Throwable) {
|
|
1388
|
+
promise.reject(t)
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* getPluginOrders - Return the plugin orders. Supported just by Theta X and Z1..
|
|
1395
|
+
* @param promise promise to set result, list of package names of plugins.
|
|
1396
|
+
*/
|
|
1397
|
+
@ReactMethod
|
|
1398
|
+
fun getPluginOrders(promise: Promise) {
|
|
1399
|
+
val theta = theta
|
|
1400
|
+
if (theta == null) {
|
|
1401
|
+
promise.reject(Exception(messageNotInit))
|
|
1402
|
+
return
|
|
1403
|
+
}
|
|
1404
|
+
launch {
|
|
1405
|
+
try {
|
|
1406
|
+
val result = theta.getPluginOrders()
|
|
1407
|
+
promise.resolve(Arguments.fromList(result))
|
|
1408
|
+
} catch (t: Throwable) {
|
|
1409
|
+
promise.reject(t)
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* setPluginOrders - Return the plugin orders. Supported just by Theta X and Z1.
|
|
1416
|
+
* @param plugins list of package names of plugins
|
|
1417
|
+
* For Z1, list size must be three. No restrictions for the size for X.
|
|
1418
|
+
* When not specifying, set an empty string.
|
|
1419
|
+
* If an empty string is placed mid-way, it will be moved to the front.
|
|
1420
|
+
* Specifying zero package name will result in an error.
|
|
1421
|
+
* @param promise promise to set result
|
|
1422
|
+
*/
|
|
1423
|
+
@ReactMethod
|
|
1424
|
+
fun setPluginOrders(plugins: ReadableArray, promise: Promise) {
|
|
1425
|
+
val theta = theta
|
|
1426
|
+
if (theta == null) {
|
|
1427
|
+
promise.reject(Exception(messageNotInit))
|
|
1428
|
+
return
|
|
1429
|
+
}
|
|
1430
|
+
launch {
|
|
1431
|
+
try {
|
|
1432
|
+
val pluginList = mutableListOf<String>()
|
|
1433
|
+
for (index in 0..(plugins.size() - 1)) {
|
|
1434
|
+
val plugin = plugins.getString(index)
|
|
1435
|
+
pluginList.add(plugin)
|
|
1436
|
+
}
|
|
1437
|
+
theta.setPluginOrders(pluginList)
|
|
1438
|
+
promise.resolve(true)
|
|
1439
|
+
} catch (t: Throwable) {
|
|
1440
|
+
promise.reject(t)
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
|
|
770
1445
|
companion object {
|
|
771
1446
|
const val NAME = "ThetaClientReactNative"
|
|
772
1447
|
const val EVENT_NAME = "ThetaFrameEvent"
|
|
1448
|
+
const val EVENT_NOTIFY = "ThetaNotify"
|
|
773
1449
|
}
|
|
774
1450
|
}
|