theta-client-react-native 1.0.2 → 1.1.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 +34 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +311 -9
- package/ios/ThetaClientReactNative.mm +528 -43
- package/lib/commonjs/capture/capture.js +118 -0
- package/lib/commonjs/capture/capture.js.map +1 -0
- package/lib/commonjs/capture/index.js +39 -0
- package/lib/commonjs/capture/index.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/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/index.js +72 -0
- package/lib/commonjs/theta-repository/index.js.map +1 -0
- package/lib/commonjs/theta-repository/options/index.js +28 -0
- package/lib/commonjs/theta-repository/options/index.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/options.js +462 -0
- package/lib/commonjs/theta-repository/options/options.js.map +1 -0
- package/lib/commonjs/theta-repository/theta-files.js +23 -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 +479 -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/module/capture/capture.js +111 -0
- package/lib/module/capture/capture.js.map +1 -0
- package/lib/module/capture/index.js +4 -0
- package/lib/module/capture/index.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/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/index.js +7 -0
- package/lib/module/theta-repository/index.js.map +1 -0
- package/lib/module/theta-repository/options/index.js +3 -0
- package/lib/module/theta-repository/options/index.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/options.js +454 -0
- package/lib/module/theta-repository/options/options.js.map +1 -0
- package/lib/module/theta-repository/theta-files.js +16 -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 +437 -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/typescript/capture/capture.d.ts +71 -0
- package/lib/typescript/capture/capture.d.ts.map +1 -0
- package/lib/typescript/capture/index.d.ts +4 -0
- package/lib/typescript/capture/index.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/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 +33 -0
- package/lib/typescript/theta-repository/access-point.d.ts.map +1 -0
- package/lib/typescript/theta-repository/index.d.ts +7 -0
- package/lib/typescript/theta-repository/index.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/index.d.ts +3 -0
- package/lib/typescript/theta-repository/options/index.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/options.d.ts +499 -0
- package/lib/typescript/theta-repository/options/options.d.ts.map +1 -0
- package/lib/typescript/theta-repository/theta-files.d.ts +32 -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 +312 -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/package.json +1 -1
- package/src/capture/capture.ts +124 -0
- package/src/capture/index.ts +3 -0
- package/src/capture/photo-capture.ts +62 -0
- package/src/capture/video-capture.ts +69 -0
- package/src/index.tsx +3 -1243
- package/src/theta-repository/access-point.ts +34 -0
- package/src/theta-repository/index.ts +6 -0
- package/src/theta-repository/options/index.ts +2 -0
- package/src/theta-repository/options/option-white-balance-auto-strength.ts +19 -0
- package/src/theta-repository/options/options.ts +554 -0
- package/src/theta-repository/theta-files.ts +34 -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 +476 -0
- package/src/theta-repository/theta-state.ts +164 -0
- package/theta-client-react-native.podspec +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Build theta-client.
|
|
6
6
|
|
|
7
7
|
```shell
|
|
8
|
-
$
|
|
8
|
+
$ gradlew publishToMavenLocal podPublishXCFramework
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
* Set the directory of theta-client to environment variable `THETA_CLIENT`.
|
|
@@ -64,3 +64,8 @@
|
|
|
64
64
|
```
|
|
65
65
|
$ yarn start
|
|
66
66
|
```
|
|
67
|
+
|
|
68
|
+
### Tips for Windows 11
|
|
69
|
+
|
|
70
|
+
* Convert your `mkpackage.sh` file from Carriage Return Line Feed "CRLF" to Line Feed "LF"
|
|
71
|
+
* Instead of running `sh mkpackage.sh` use `bash mkpackage.sh`
|
package/android/build.gradle
CHANGED
|
@@ -135,7 +135,7 @@ dependencies {
|
|
|
135
135
|
implementation "com.facebook.react:react-native:+"
|
|
136
136
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
137
137
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4-native-mt"
|
|
138
|
-
implementation "com.ricoh360.thetaclient:theta-client:1.
|
|
138
|
+
implementation "com.ricoh360.thetaclient:theta-client:1.1.0"
|
|
139
139
|
|
|
140
140
|
// From node_modules
|
|
141
141
|
}
|
|
@@ -47,6 +47,23 @@ class ApertureConverter : OptionConverter {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* BluetoothPowerConverter
|
|
52
|
+
*/
|
|
53
|
+
class BluetoothPowerConverter : OptionConverter {
|
|
54
|
+
override fun setToTheta(options: ThetaRepository.Options, objects: ReadableMap) {
|
|
55
|
+
objects.getString("bluetoothPower")?.let {
|
|
56
|
+
options.bluetoothPower = ThetaRepository.BluetoothPowerEnum.valueOf(it)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
override fun setFromTheta(options: ThetaRepository.Options, objects: WritableMap) {
|
|
61
|
+
options.bluetoothPower?.let {
|
|
62
|
+
objects.putString("bluetoothPower", it.toString())
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
50
67
|
/**
|
|
51
68
|
* CaptureModeConverter
|
|
52
69
|
*/
|
|
@@ -373,6 +390,23 @@ class WhiteBalanceConverter : OptionConverter {
|
|
|
373
390
|
}
|
|
374
391
|
}
|
|
375
392
|
|
|
393
|
+
/**
|
|
394
|
+
* WhiteBalanceAutoStrengthConverter
|
|
395
|
+
*/
|
|
396
|
+
class WhiteBalanceAutoStrengthConverter : OptionConverter {
|
|
397
|
+
override fun setToTheta(options: ThetaRepository.Options, objects: ReadableMap) {
|
|
398
|
+
objects.getString("whiteBalanceAutoStrength")?.let {
|
|
399
|
+
options.whiteBalanceAutoStrength = ThetaRepository.WhiteBalanceAutoStrengthEnum.valueOf(it)
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
override fun setFromTheta(options: ThetaRepository.Options, objects: WritableMap) {
|
|
404
|
+
options.whiteBalanceAutoStrength?.let {
|
|
405
|
+
objects.putString("whiteBalanceAutoStrength", it.toString())
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
376
410
|
/**
|
|
377
411
|
* ColorTemperatureConverter
|
|
378
412
|
*/
|
|
@@ -85,12 +85,26 @@ class ThetaClientReactNativeModule(
|
|
|
85
85
|
try {
|
|
86
86
|
val info = theta.getThetaInfo()
|
|
87
87
|
val result = Arguments.createMap()
|
|
88
|
+
result.putString("manufacturer", info.manufacturer)
|
|
88
89
|
result.putString("model", info.model)
|
|
89
90
|
result.putString("serialNumber", info.serialNumber)
|
|
91
|
+
info.wlanMacAddress?.also {
|
|
92
|
+
result.putString("wlanMacAddress", info.wlanMacAddress)
|
|
93
|
+
} ?: result.putNull("wlanMacAddress")
|
|
94
|
+
info.bluetoothMacAddress?.also {
|
|
95
|
+
result.putString("bluetoothMacAddress", info.bluetoothMacAddress)
|
|
96
|
+
} ?: result.putNull("bluetoothMacAddress")
|
|
90
97
|
result.putString("firmwareVersion", info.firmwareVersion)
|
|
98
|
+
result.putString("supportUrl", info.supportUrl)
|
|
91
99
|
result.putBoolean("hasGps", info.hasGps)
|
|
92
100
|
result.putBoolean("hasGyro", info.hasGyro)
|
|
93
101
|
result.putInt("uptime", info.uptime)
|
|
102
|
+
result.putArray("api", Arguments.fromList(info.api))
|
|
103
|
+
val ep = Arguments.createMap()
|
|
104
|
+
ep.putInt("httpPort", info.endpoints.httpPort)
|
|
105
|
+
ep.putInt("httpUpdatesPort", info.endpoints.httpUpdatesPort)
|
|
106
|
+
result.putMap("endpoints", ep)
|
|
107
|
+
result.putArray("apiLevel", Arguments.fromList(info.apiLevel))
|
|
94
108
|
promise.resolve(result)
|
|
95
109
|
} catch (t: Throwable) {
|
|
96
110
|
promise.reject(t)
|
|
@@ -110,11 +124,40 @@ class ThetaClientReactNativeModule(
|
|
|
110
124
|
val result = Arguments.createMap()
|
|
111
125
|
result.putString("fingerprint", state.fingerprint)
|
|
112
126
|
result.putDouble("batteryLevel", state.batteryLevel.toDouble())
|
|
113
|
-
result.putString("
|
|
114
|
-
result.
|
|
127
|
+
result.putString("storageUri", state.storageUri)
|
|
128
|
+
result.putString("storageID", state.storageID)
|
|
129
|
+
result.putString("captureStatus", state.captureStatus.toString())
|
|
115
130
|
result.putInt("recordedTime", state.recordedTime)
|
|
116
131
|
result.putInt("recordableTime", state.recordableTime)
|
|
132
|
+
state.capturedPictures?.also {
|
|
133
|
+
result.putInt("capturedPictures", state.capturedPictures!!)
|
|
134
|
+
} ?: result.putNull("capturedPictures")
|
|
135
|
+
state.compositeShootingElapsedTime?.also {
|
|
136
|
+
result.putString("compositeShootingElapsedTime", state.compositeShootingElapsedTime.toString())
|
|
137
|
+
} ?: result.putNull("compositeShootingElapsedTime")
|
|
117
138
|
result.putString("latestFileUrl", state.latestFileUrl)
|
|
139
|
+
result.putString("chargingState", state.chargingState.toString())
|
|
140
|
+
result.putInt("apiVersion", state.apiVersion)
|
|
141
|
+
state.isPluginRunning?.also {
|
|
142
|
+
result.putBoolean("isPluginRunning", state.isPluginRunning!!)
|
|
143
|
+
} ?: result.putNull("isPluginRunning")
|
|
144
|
+
state.isPluginWebServer?.also {
|
|
145
|
+
result.putBoolean("isPluginWebServer", state.isPluginWebServer!!)
|
|
146
|
+
} ?: result.putNull("isPluginWebServer")
|
|
147
|
+
state.function?.also {
|
|
148
|
+
result.putString("function", state.function.toString())
|
|
149
|
+
} ?: result.putNull("function")
|
|
150
|
+
state.isMySettingChanged?.also {
|
|
151
|
+
result.putBoolean("isMySettingChanged", state.isMySettingChanged!!)
|
|
152
|
+
} ?: result.putNull("isMySettingChanged")
|
|
153
|
+
result.putString("currentMicrophone", state.currentMicrophone?.toString())
|
|
154
|
+
result.putBoolean("isSdCard", state.isSdCard)
|
|
155
|
+
state.cameraError?.also {
|
|
156
|
+
result.putArray("cameraError", Arguments.makeNativeArray(state.cameraError!!.map { it.toString() }))
|
|
157
|
+
} ?: result.putNull("cameraError")
|
|
158
|
+
state.isBatteryInsert?.also {
|
|
159
|
+
result.putString("isBatteryInsert", state.isBatteryInsert.toString())
|
|
160
|
+
} ?: result.putNull("isBatteryInsert")
|
|
118
161
|
promise.resolve(result)
|
|
119
162
|
} catch (t: Throwable) {
|
|
120
163
|
promise.reject(t)
|
|
@@ -133,13 +176,13 @@ class ThetaClientReactNativeModule(
|
|
|
133
176
|
fun listFiles(fileType: String, startPosition: Int, entryCount: Int, promise: Promise) {
|
|
134
177
|
launch {
|
|
135
178
|
try {
|
|
136
|
-
val
|
|
179
|
+
val (fileList, totalEntries) = theta.listFiles(
|
|
137
180
|
ThetaRepository.FileTypeEnum.valueOf(fileType),
|
|
138
181
|
startPosition,
|
|
139
182
|
entryCount
|
|
140
183
|
)
|
|
141
184
|
val resultlist = Arguments.createArray()
|
|
142
|
-
|
|
185
|
+
fileList.forEach {
|
|
143
186
|
val result = Arguments.createMap()
|
|
144
187
|
result.putString("name", it.name)
|
|
145
188
|
result.putDouble("size", it.size.toDouble())
|
|
@@ -148,7 +191,10 @@ class ThetaClientReactNativeModule(
|
|
|
148
191
|
result.putString("fileUrl", it.fileUrl)
|
|
149
192
|
resultlist.pushMap(result)
|
|
150
193
|
}
|
|
151
|
-
|
|
194
|
+
val resultmap = Arguments.createMap()
|
|
195
|
+
resultmap.putArray("fileList", resultlist)
|
|
196
|
+
resultmap.putInt("totalEntries", totalEntries)
|
|
197
|
+
promise.resolve(resultmap)
|
|
152
198
|
} catch (t: Throwable) {
|
|
153
199
|
promise.reject(t)
|
|
154
200
|
}
|
|
@@ -227,6 +273,7 @@ class ThetaClientReactNativeModule(
|
|
|
227
273
|
/** option converter */
|
|
228
274
|
private val converters = mapOf(
|
|
229
275
|
"aperture" to ApertureConverter(),
|
|
276
|
+
"bluetoothPower" to BluetoothPowerConverter(),
|
|
230
277
|
"captureMode" to CaptureModeConverter(),
|
|
231
278
|
"colorTemperature" to ColorTemperatureConverter(),
|
|
232
279
|
"dateTimeZone" to DateTimeZoneConverter(),
|
|
@@ -249,12 +296,14 @@ class ThetaClientReactNativeModule(
|
|
|
249
296
|
"totalSpace" to TotalSpaceConverter(),
|
|
250
297
|
"shutterVolume" to ShutterVolumeConverter(),
|
|
251
298
|
"whiteBalance" to WhiteBalanceConverter(),
|
|
299
|
+
"whiteBalanceAutoStrength" to WhiteBalanceAutoStrengthConverter(),
|
|
252
300
|
"_gpsTagRecording" to GpsTagRecordingConverter(),
|
|
253
301
|
)
|
|
302
|
+
|
|
254
303
|
/** OptionNameEnum to option */
|
|
255
304
|
private val optionEnumToOption = mapOf(
|
|
256
305
|
"Aperture" to "aperture",
|
|
257
|
-
"
|
|
306
|
+
"BluetoothPower" to "bluetoothPower",
|
|
258
307
|
"CaptureMode" to "captureMode",
|
|
259
308
|
"ColorTemperature" to "colorTemperature",
|
|
260
309
|
"DateTimeZone" to "dateTimeZone",
|
|
@@ -277,6 +326,7 @@ class ThetaClientReactNativeModule(
|
|
|
277
326
|
"TotalSpace" to "totalSpace",
|
|
278
327
|
"ShutterVolume" to "shutterVolume",
|
|
279
328
|
"WhiteBalance" to "whiteBalance",
|
|
329
|
+
"WhiteBalanceAutoStrength" to "whiteBalanceAutoStrength",
|
|
280
330
|
)
|
|
281
331
|
|
|
282
332
|
/**
|
|
@@ -344,9 +394,11 @@ class ThetaClientReactNativeModule(
|
|
|
344
394
|
return previewing
|
|
345
395
|
}
|
|
346
396
|
val param = Arguments.createMap()
|
|
347
|
-
param.putString(
|
|
348
|
-
|
|
349
|
-
|
|
397
|
+
param.putString(
|
|
398
|
+
"data",
|
|
399
|
+
"data:image/jpeg;base64," +
|
|
400
|
+
packet.first.copyOfRange(0, packet.second).toBase64()
|
|
401
|
+
)
|
|
350
402
|
reactApplicationContext
|
|
351
403
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
352
404
|
.emit(EVENT_NAME, param)
|
|
@@ -767,6 +819,256 @@ class ThetaClientReactNativeModule(
|
|
|
767
819
|
}
|
|
768
820
|
}
|
|
769
821
|
|
|
822
|
+
/**
|
|
823
|
+
* setBluetoothDevice - register uuid of a BLE device
|
|
824
|
+
* @param uuid uuid to set
|
|
825
|
+
* @param promise promise to set result
|
|
826
|
+
*/
|
|
827
|
+
@ReactMethod
|
|
828
|
+
fun setBluetoothDevice(uuid: String, promise: Promise) {
|
|
829
|
+
launch {
|
|
830
|
+
try {
|
|
831
|
+
val deviceName = theta.setBluetoothDevice(uuid)
|
|
832
|
+
promise.resolve(deviceName)
|
|
833
|
+
} catch (t: Throwable) {
|
|
834
|
+
promise.reject(t)
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* getMySetting - Acquires the shooting properties set by the camera._setMySetting command.
|
|
841
|
+
* Just for Theta V and later
|
|
842
|
+
* @param captureMode The target shooting mode
|
|
843
|
+
* @param promise promise to set result
|
|
844
|
+
*/
|
|
845
|
+
@ReactMethod
|
|
846
|
+
fun getMySetting(captureMode: String, promise: Promise) {
|
|
847
|
+
launch {
|
|
848
|
+
try {
|
|
849
|
+
val options = theta.getMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
|
|
850
|
+
val result = Arguments.createMap()
|
|
851
|
+
converters.forEach {
|
|
852
|
+
val cvt = it.value
|
|
853
|
+
cvt?.setFromTheta(options, result)
|
|
854
|
+
}
|
|
855
|
+
promise.resolve(result)
|
|
856
|
+
} catch (t: Throwable) {
|
|
857
|
+
promise.reject(t)
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* getMySettingFromOldModel - Acquires the shooting properties set by the camera._setMySetting command.
|
|
864
|
+
* Just for Theta S and SC.
|
|
865
|
+
* @param optionNames The target shooting mode
|
|
866
|
+
* @param promise promise to set result
|
|
867
|
+
*/
|
|
868
|
+
@ReactMethod
|
|
869
|
+
fun getMySettingFromOldModel(optionNames: ReadableArray, promise: Promise) {
|
|
870
|
+
launch {
|
|
871
|
+
try {
|
|
872
|
+
val optionNameList = mutableListOf<ThetaRepository.OptionNameEnum>()
|
|
873
|
+
for (index in 0..(optionNames.size() - 1)) {
|
|
874
|
+
val option = optionNames.getString(index)
|
|
875
|
+
optionNameList.add(ThetaRepository.OptionNameEnum.valueOf(option))
|
|
876
|
+
}
|
|
877
|
+
val options = theta.getMySetting(optionNameList)
|
|
878
|
+
val result = Arguments.createMap()
|
|
879
|
+
for (index in 0..(optionNames.size() - 1)) {
|
|
880
|
+
val option = optionEnumToOption[optionNames.getString(index)]
|
|
881
|
+
val cvt = converters[option]
|
|
882
|
+
cvt?.setFromTheta(options, result)
|
|
883
|
+
}
|
|
884
|
+
promise.resolve(result)
|
|
885
|
+
} catch (t: Throwable) {
|
|
886
|
+
promise.reject(t)
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* setMySetting - Registers shooting conditions in My Settings
|
|
893
|
+
* @param captureMode The target shooting mode. RICOH THETA S and SC do not support My Settings in video capture mode.
|
|
894
|
+
* @param options registered to My Settings
|
|
895
|
+
* @param Promise of bolean result, always true
|
|
896
|
+
*/
|
|
897
|
+
@ReactMethod
|
|
898
|
+
fun setMySetting(captureMode: String, options: ReadableMap, promise: Promise) {
|
|
899
|
+
launch {
|
|
900
|
+
try {
|
|
901
|
+
val thetaOptions = ThetaRepository.Options()
|
|
902
|
+
val iterator = options.keySetIterator()
|
|
903
|
+
while (iterator.hasNextKey()) {
|
|
904
|
+
val key = iterator.nextKey()
|
|
905
|
+
val cvt = converters[key]
|
|
906
|
+
cvt?.setToTheta(thetaOptions, options)
|
|
907
|
+
}
|
|
908
|
+
theta.setMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode), thetaOptions)
|
|
909
|
+
promise.resolve(true)
|
|
910
|
+
} catch (t: Throwable) {
|
|
911
|
+
promise.reject(t)
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* deleteMySetting - Delete shooting conditions in My Settings. Supported just by Theta X and Z1.
|
|
918
|
+
* @param captureMode The target shooting mode
|
|
919
|
+
* @param promise promise to set result, always true
|
|
920
|
+
*/
|
|
921
|
+
@ReactMethod
|
|
922
|
+
fun deleteMySetting(captureMode: String, promise: Promise) {
|
|
923
|
+
launch {
|
|
924
|
+
try {
|
|
925
|
+
theta.deleteMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
|
|
926
|
+
promise.resolve(true)
|
|
927
|
+
} catch (t: Throwable) {
|
|
928
|
+
promise.reject(t)
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* listPlugins - acquires a list of installed plugins
|
|
935
|
+
* @param promise promise to set result
|
|
936
|
+
*/
|
|
937
|
+
@ReactMethod
|
|
938
|
+
fun listPlugins(promise: Promise) {
|
|
939
|
+
launch {
|
|
940
|
+
try {
|
|
941
|
+
val result = Arguments.createArray()
|
|
942
|
+
theta.listPlugins().forEach {
|
|
943
|
+
val pinfo = Arguments.createMap()
|
|
944
|
+
pinfo.putString("name", it.name)
|
|
945
|
+
pinfo.putString("packageName", it.packageName)
|
|
946
|
+
pinfo.putString("version", it.version)
|
|
947
|
+
pinfo.putBoolean("isPreInstalled", it.isPreInstalled)
|
|
948
|
+
pinfo.putBoolean("isRunning", it.isRunning)
|
|
949
|
+
pinfo.putBoolean("isForeground", it.isForeground)
|
|
950
|
+
pinfo.putBoolean("isBoot", it.isBoot)
|
|
951
|
+
pinfo.putBoolean("hasWebServer", it.hasWebServer)
|
|
952
|
+
pinfo.putString("exitStatus", it.exitStatus)
|
|
953
|
+
pinfo.putString("message", it.message)
|
|
954
|
+
result.pushMap(pinfo)
|
|
955
|
+
}
|
|
956
|
+
promise.resolve(result)
|
|
957
|
+
} catch (t: Throwable) {
|
|
958
|
+
promise.reject(t)
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* setPlugin - sets the installed plugin for boot. Supported just by Theta V.
|
|
965
|
+
* @param packageName Package name of the target plugin.
|
|
966
|
+
* @param promise promise to set result
|
|
967
|
+
*/
|
|
968
|
+
@ReactMethod
|
|
969
|
+
fun setPlugin(packageName: String, promise: Promise) {
|
|
970
|
+
launch {
|
|
971
|
+
try {
|
|
972
|
+
theta.setPlugin(packageName)
|
|
973
|
+
promise.resolve(true)
|
|
974
|
+
} catch (t: Throwable) {
|
|
975
|
+
promise.reject(t)
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* startPlugin - start the plugin specified by the [packageName].
|
|
982
|
+
* @param packageName Package name of the target plugin.
|
|
983
|
+
* @param promise promise to set result
|
|
984
|
+
*/
|
|
985
|
+
@ReactMethod
|
|
986
|
+
fun startPlugin(packageName: String, promise: Promise) {
|
|
987
|
+
launch {
|
|
988
|
+
try {
|
|
989
|
+
theta.startPlugin(packageName)
|
|
990
|
+
promise.resolve(true)
|
|
991
|
+
} catch (t: Throwable) {
|
|
992
|
+
promise.reject(t)
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* stopPlugin - Stop the running plugin.
|
|
999
|
+
* @param promise promise to set result
|
|
1000
|
+
*/
|
|
1001
|
+
@ReactMethod
|
|
1002
|
+
fun stopPlugin(promise: Promise) {
|
|
1003
|
+
launch {
|
|
1004
|
+
try {
|
|
1005
|
+
theta.stopPlugin()
|
|
1006
|
+
promise.resolve(true)
|
|
1007
|
+
} catch (t: Throwable) {
|
|
1008
|
+
promise.reject(t)
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* getPluginLicense - acquires the license for the installed plugin.
|
|
1015
|
+
* @param packageName Package name of the target plugin.
|
|
1016
|
+
* @param promise promise to set result
|
|
1017
|
+
*/
|
|
1018
|
+
@ReactMethod
|
|
1019
|
+
fun getPluginLicense(packageName: String, promise: Promise) {
|
|
1020
|
+
launch {
|
|
1021
|
+
try {
|
|
1022
|
+
val result = theta.getPluginLicense(packageName)
|
|
1023
|
+
promise.resolve(result)
|
|
1024
|
+
} catch (t: Throwable) {
|
|
1025
|
+
promise.reject(t)
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* getPluginOrders - Return the plugin orders. Supported just by Theta X and Z1..
|
|
1032
|
+
* @param promise promise to set result, list of package names of plugins.
|
|
1033
|
+
*/
|
|
1034
|
+
@ReactMethod
|
|
1035
|
+
fun getPluginOrders(promise: Promise) {
|
|
1036
|
+
launch {
|
|
1037
|
+
try {
|
|
1038
|
+
val result = theta.getPluginOrders()
|
|
1039
|
+
promise.resolve(Arguments.fromList(result))
|
|
1040
|
+
} catch (t: Throwable) {
|
|
1041
|
+
promise.reject(t)
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* setPluginOrders - Return the plugin orders. Supported just by Theta X and Z1.
|
|
1048
|
+
* @param plugins list of package names of plugins
|
|
1049
|
+
* For Z1, list size must be three. No restrictions for the size for X.
|
|
1050
|
+
* When not specifying, set an empty string.
|
|
1051
|
+
* If an empty string is placed mid-way, it will be moved to the front.
|
|
1052
|
+
* Specifying zero package name will result in an error.
|
|
1053
|
+
* @param promise promise to set result
|
|
1054
|
+
*/
|
|
1055
|
+
@ReactMethod
|
|
1056
|
+
fun setPluginOrders(plugins: ReadableArray, promise: Promise) {
|
|
1057
|
+
launch {
|
|
1058
|
+
try {
|
|
1059
|
+
val pluginList = mutableListOf<String>()
|
|
1060
|
+
for (index in 0..(plugins.size() - 1)) {
|
|
1061
|
+
val plugin = plugins.getString(index)
|
|
1062
|
+
pluginList.add(plugin)
|
|
1063
|
+
}
|
|
1064
|
+
theta.setPluginOrders(pluginList)
|
|
1065
|
+
promise.resolve(true)
|
|
1066
|
+
} catch (t: Throwable) {
|
|
1067
|
+
promise.reject(t)
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
770
1072
|
companion object {
|
|
771
1073
|
const val NAME = "ThetaClientReactNative"
|
|
772
1074
|
const val EVENT_NAME = "ThetaFrameEvent"
|