theta-client-react-native 1.5.0 → 1.6.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 +2 -2
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +81 -7
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +133 -3
- package/ios/ConvertUtil.swift +129 -0
- package/ios/ThetaClientReactNative.m +14 -0
- package/ios/ThetaClientReactNative.swift +155 -2
- package/lib/commonjs/capture/composite-interval-capture.js +112 -0
- package/lib/commonjs/capture/composite-interval-capture.js.map +1 -0
- package/lib/commonjs/capture/index.js +11 -0
- package/lib/commonjs/capture/index.js.map +1 -1
- package/lib/commonjs/capture/shot-count-specified-interval-capture.js +1 -0
- package/lib/commonjs/capture/shot-count-specified-interval-capture.js.map +1 -1
- package/lib/commonjs/capture/time-shift-capture.js +9 -1
- package/lib/commonjs/capture/time-shift-capture.js.map +1 -1
- package/lib/commonjs/theta-repository/options/index.js +11 -0
- package/lib/commonjs/theta-repository/options/index.js.map +1 -1
- package/lib/commonjs/theta-repository/options/option-auto-bracket.js +6 -0
- package/lib/commonjs/theta-repository/options/option-auto-bracket.js.map +1 -0
- package/lib/commonjs/theta-repository/options/options.js +2 -0
- package/lib/commonjs/theta-repository/options/options.js.map +1 -1
- package/lib/commonjs/theta-repository/theta-repository.js +12 -0
- package/lib/commonjs/theta-repository/theta-repository.js.map +1 -1
- package/lib/module/capture/composite-interval-capture.js +104 -0
- package/lib/module/capture/composite-interval-capture.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/shot-count-specified-interval-capture.js +1 -0
- package/lib/module/capture/shot-count-specified-interval-capture.js.map +1 -1
- package/lib/module/capture/time-shift-capture.js +9 -1
- package/lib/module/capture/time-shift-capture.js.map +1 -1
- package/lib/module/theta-repository/options/index.js +1 -0
- package/lib/module/theta-repository/options/index.js.map +1 -1
- package/lib/module/theta-repository/options/option-auto-bracket.js +2 -0
- package/lib/module/theta-repository/options/option-auto-bracket.js.map +1 -0
- package/lib/module/theta-repository/options/options.js +2 -0
- package/lib/module/theta-repository/options/options.js.map +1 -1
- package/lib/module/theta-repository/theta-repository.js +12 -1
- package/lib/module/theta-repository/theta-repository.js.map +1 -1
- package/lib/typescript/capture/composite-interval-capture.d.ts +47 -0
- package/lib/typescript/capture/composite-interval-capture.d.ts.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/shot-count-specified-interval-capture.d.ts +1 -0
- package/lib/typescript/capture/shot-count-specified-interval-capture.d.ts.map +1 -1
- package/lib/typescript/capture/time-shift-capture.d.ts +2 -1
- package/lib/typescript/capture/time-shift-capture.d.ts.map +1 -1
- package/lib/typescript/theta-repository/options/index.d.ts +1 -0
- package/lib/typescript/theta-repository/options/index.d.ts.map +1 -1
- package/lib/typescript/theta-repository/options/option-auto-bracket.d.ts +36 -0
- package/lib/typescript/theta-repository/options/option-auto-bracket.d.ts.map +1 -0
- package/lib/typescript/theta-repository/options/options.d.ts +5 -0
- package/lib/typescript/theta-repository/options/options.d.ts.map +1 -1
- package/lib/typescript/theta-repository/theta-repository.d.ts +9 -1
- package/lib/typescript/theta-repository/theta-repository.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/capture/composite-interval-capture.ts +140 -0
- package/src/capture/index.ts +1 -0
- package/src/capture/shot-count-specified-interval-capture.ts +1 -0
- package/src/capture/time-shift-capture.ts +19 -1
- package/src/theta-repository/options/index.ts +1 -0
- package/src/theta-repository/options/option-auto-bracket.ts +48 -0
- package/src/theta-repository/options/options.ts +5 -0
- package/src/theta-repository/theta-repository.ts +14 -0
- package/theta-client-react-native.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -134,8 +134,8 @@ dependencies {
|
|
|
134
134
|
//noinspection GradleDynamicVersion
|
|
135
135
|
implementation "com.facebook.react:react-native:+"
|
|
136
136
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
137
|
-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4
|
|
138
|
-
implementation "com.ricoh360.thetaclient:theta-client:1.
|
|
137
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
|
|
138
|
+
implementation "com.ricoh360.thetaclient:theta-client:1.6.0"
|
|
139
139
|
|
|
140
140
|
// From node_modules
|
|
141
141
|
}
|
|
@@ -8,12 +8,7 @@ import com.facebook.react.bridge.WritableMap
|
|
|
8
8
|
import com.facebook.react.bridge.WritableArray
|
|
9
9
|
import com.ricoh360.thetaclient.DigestAuth
|
|
10
10
|
import com.ricoh360.thetaclient.ThetaRepository.*
|
|
11
|
-
import com.ricoh360.thetaclient.capture
|
|
12
|
-
import com.ricoh360.thetaclient.capture.PhotoCapture
|
|
13
|
-
import com.ricoh360.thetaclient.capture.TimeShiftCapture
|
|
14
|
-
import com.ricoh360.thetaclient.capture.VideoCapture
|
|
15
|
-
import com.ricoh360.thetaclient.capture.LimitlessIntervalCapture
|
|
16
|
-
import com.ricoh360.thetaclient.capture.ShotCountSpecifiedIntervalCapture
|
|
11
|
+
import com.ricoh360.thetaclient.capture.*
|
|
17
12
|
|
|
18
13
|
const val KEY_NOTIFY_NAME = "name"
|
|
19
14
|
const val KEY_NOTIFY_PARAMS = "params"
|
|
@@ -23,6 +18,7 @@ const val KEY_NOTIFY_PARAM_MESSAGE = "message"
|
|
|
23
18
|
val optionItemNameToEnum: Map<String, OptionNameEnum> = mutableMapOf(
|
|
24
19
|
"aiAutoThumbnail" to OptionNameEnum.AiAutoThumbnail,
|
|
25
20
|
"aperture" to OptionNameEnum.Aperture,
|
|
21
|
+
"autoBracket" to OptionNameEnum.AutoBracket,
|
|
26
22
|
"bitrate" to OptionNameEnum.Bitrate,
|
|
27
23
|
"bluetoothPower" to OptionNameEnum.BluetoothPower,
|
|
28
24
|
"burstMode" to OptionNameEnum.BurstMode,
|
|
@@ -51,6 +47,7 @@ val optionItemNameToEnum: Map<String, OptionNameEnum> = mutableMapOf(
|
|
|
51
47
|
"iso" to OptionNameEnum.Iso,
|
|
52
48
|
"isoAutoHighLimit" to OptionNameEnum.IsoAutoHighLimit,
|
|
53
49
|
"language" to OptionNameEnum.Language,
|
|
50
|
+
"latestEnabledExposureDelayTime" to OptionNameEnum.LatestEnabledExposureDelayTime,
|
|
54
51
|
"maxRecordableTime" to OptionNameEnum.MaxRecordableTime,
|
|
55
52
|
"networkType" to OptionNameEnum.NetworkType,
|
|
56
53
|
"offDelay" to OptionNameEnum.OffDelay,
|
|
@@ -69,6 +66,8 @@ val optionItemNameToEnum: Map<String, OptionNameEnum> = mutableMapOf(
|
|
|
69
66
|
"timeShift" to OptionNameEnum.TimeShift,
|
|
70
67
|
"totalSpace" to OptionNameEnum.TotalSpace,
|
|
71
68
|
"username" to OptionNameEnum.Username,
|
|
69
|
+
"videoStitching" to OptionNameEnum.VideoStitching,
|
|
70
|
+
"visibilityReduction" to OptionNameEnum.VisibilityReduction,
|
|
72
71
|
"whiteBalance" to OptionNameEnum.WhiteBalance,
|
|
73
72
|
"whiteBalanceAutoStrength" to OptionNameEnum.WhiteBalanceAutoStrength,
|
|
74
73
|
"wlanFrequency" to OptionNameEnum.WlanFrequency,
|
|
@@ -202,6 +201,18 @@ fun setShotCountSpecifiedIntervalCaptureBuilderParams(optionMap: ReadableMap, bu
|
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
|
|
204
|
+
fun setCompositeIntervalCaptureBuilderParams(optionMap: ReadableMap, builder: CompositeIntervalCapture.Builder) {
|
|
205
|
+
val interval = if (optionMap.hasKey("_capture_interval")) optionMap.getInt("_capture_interval") else null
|
|
206
|
+
interval?.let {
|
|
207
|
+
if (it >= 0) {
|
|
208
|
+
builder.setCheckStatusCommandInterval(it.toLong())
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (optionMap.hasKey("compositeShootingOutputInterval")) {
|
|
212
|
+
builder.setCompositeShootingOutputInterval(optionMap.getInt("compositeShootingOutputInterval"))
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
205
216
|
fun toGetOptionsParam(optionNames: ReadableArray): MutableList<OptionNameEnum> {
|
|
206
217
|
val optionNameList = mutableListOf<OptionNameEnum>()
|
|
207
218
|
for (index in 0..(optionNames.size() - 1)) {
|
|
@@ -231,7 +242,11 @@ fun toResult(options: Options): WritableMap {
|
|
|
231
242
|
OptionNameEnum.Username
|
|
232
243
|
)
|
|
233
244
|
OptionNameEnum.values().forEach { name ->
|
|
234
|
-
if (name == OptionNameEnum.
|
|
245
|
+
if (name == OptionNameEnum.AutoBracket) {
|
|
246
|
+
options.autoBracket?.let {
|
|
247
|
+
result.putArray("autoBracket", toResult(autoBracket = it))
|
|
248
|
+
}
|
|
249
|
+
} else if (name == OptionNameEnum.Bitrate) {
|
|
235
250
|
options.bitrate?.let { bitrate ->
|
|
236
251
|
if (bitrate is BitrateEnum) {
|
|
237
252
|
result.putString("bitrate", bitrate.toString())
|
|
@@ -288,6 +303,38 @@ fun <T> addOptionsValueToMap(options: Options, name: OptionNameEnum, objects: Wr
|
|
|
288
303
|
}
|
|
289
304
|
}
|
|
290
305
|
|
|
306
|
+
fun toResult(autoBracket: BracketSettingList): WritableArray {
|
|
307
|
+
val resultList = Arguments.createArray()
|
|
308
|
+
|
|
309
|
+
autoBracket.list?.forEach { bracketSetting ->
|
|
310
|
+
val result = Arguments.createMap()
|
|
311
|
+
bracketSetting.aperture?.name?.let { name ->
|
|
312
|
+
result.putString("aperture", name)
|
|
313
|
+
}
|
|
314
|
+
bracketSetting.colorTemperature?.let { value ->
|
|
315
|
+
result.putInt("colorTemperature", value)
|
|
316
|
+
}
|
|
317
|
+
bracketSetting.exposureCompensation?.name?.let { name ->
|
|
318
|
+
result.putString("exposureCompensation", name)
|
|
319
|
+
}
|
|
320
|
+
bracketSetting.exposureProgram?.name?.let { name ->
|
|
321
|
+
result.putString("exposureProgram", name)
|
|
322
|
+
}
|
|
323
|
+
bracketSetting.iso?.name?.let { name ->
|
|
324
|
+
result.putString("iso", name)
|
|
325
|
+
}
|
|
326
|
+
bracketSetting.shutterSpeed?.name?.let { name ->
|
|
327
|
+
result.putString("shutterSpeed", name)
|
|
328
|
+
}
|
|
329
|
+
bracketSetting.whiteBalance?.name?.let { name ->
|
|
330
|
+
result.putString("whiteBalance", name)
|
|
331
|
+
}
|
|
332
|
+
resultList.pushMap(result)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return resultList
|
|
336
|
+
}
|
|
337
|
+
|
|
291
338
|
fun toResult(burstOption: BurstOption): WritableMap {
|
|
292
339
|
val result = Arguments.createMap()
|
|
293
340
|
burstOption.burstCaptureNum?.value?.name?.let { name ->
|
|
@@ -463,6 +510,10 @@ fun setOptionValue(options: Options, name: OptionNameEnum, optionsMap: ReadableM
|
|
|
463
510
|
options.setValue(name, optionsMap.getDouble(key).toLong())
|
|
464
511
|
} else if (boolOptions.contains(name)) {
|
|
465
512
|
options.setValue(name, optionsMap.getBoolean(key))
|
|
513
|
+
} else if (name == OptionNameEnum.AutoBracket) {
|
|
514
|
+
optionsMap.getArray(key)?.let {
|
|
515
|
+
options.setValue(name, toAutoBracket(list = it))
|
|
516
|
+
}
|
|
466
517
|
} else if (name == OptionNameEnum.Bitrate) {
|
|
467
518
|
val type = optionsMap.getType(key)
|
|
468
519
|
if (type == ReadableType.Number) {
|
|
@@ -519,6 +570,7 @@ fun getOptionValueEnum(name: OptionNameEnum, valueName: String): Any? {
|
|
|
519
570
|
OptionNameEnum.Iso -> IsoEnum.values().find { it.name == valueName }
|
|
520
571
|
OptionNameEnum.IsoAutoHighLimit -> IsoAutoHighLimitEnum.values().find { it.name == valueName }
|
|
521
572
|
OptionNameEnum.Language -> LanguageEnum.values().find { it.name == valueName }
|
|
573
|
+
OptionNameEnum.LatestEnabledExposureDelayTime -> ExposureDelayEnum.values().find { it.name == valueName }
|
|
522
574
|
OptionNameEnum.MaxRecordableTime -> MaxRecordableTimeEnum.values().find { it.name == valueName }
|
|
523
575
|
OptionNameEnum.NetworkType -> NetworkTypeEnum.values().find { it.name == valueName }
|
|
524
576
|
OptionNameEnum.OffDelay -> OffDelayEnum.values().find { it.name == valueName }
|
|
@@ -528,6 +580,8 @@ fun getOptionValueEnum(name: OptionNameEnum, valueName: String): Any? {
|
|
|
528
580
|
OptionNameEnum.ShootingMethod -> ShootingMethodEnum.values().find { it.name == valueName }
|
|
529
581
|
OptionNameEnum.ShutterSpeed -> ShutterSpeedEnum.values().find { it.name == valueName }
|
|
530
582
|
OptionNameEnum.SleepDelay -> SleepDelayEnum.values().find { it.name == valueName }
|
|
583
|
+
OptionNameEnum.VideoStitching -> VideoStitchingEnum.values().find { it.name == valueName }
|
|
584
|
+
OptionNameEnum.VisibilityReduction -> VisibilityReductionEnum.values().find { it.name == valueName }
|
|
531
585
|
OptionNameEnum.WhiteBalance -> WhiteBalanceEnum.values().find { it.name == valueName }
|
|
532
586
|
OptionNameEnum.WhiteBalanceAutoStrength -> WhiteBalanceAutoStrengthEnum.values().find { it.name == valueName }
|
|
533
587
|
OptionNameEnum.WlanFrequency -> WlanFrequencyEnum.values().find { it.name == valueName }
|
|
@@ -556,6 +610,26 @@ fun toListAccessPointsResult(accessPointList: List<AccessPoint>): WritableArray
|
|
|
556
610
|
return result
|
|
557
611
|
}
|
|
558
612
|
|
|
613
|
+
fun toAutoBracket(list: ReadableArray): BracketSettingList {
|
|
614
|
+
val autoBracket = BracketSettingList()
|
|
615
|
+
for (i in 0 until list.size()) {
|
|
616
|
+
list.getMap(i)?.let { setting ->
|
|
617
|
+
autoBracket.add(
|
|
618
|
+
BracketSetting(
|
|
619
|
+
aperture = setting.getString("aperture")?.let { ApertureEnum.valueOf(it) },
|
|
620
|
+
colorTemperature = if (setting.hasKey("colorTemperature")) setting.getInt("colorTemperature") else null,
|
|
621
|
+
exposureCompensation = setting.getString("exposureCompensation")?.let { ExposureCompensationEnum.valueOf(it) },
|
|
622
|
+
exposureProgram = setting.getString("exposureProgram")?.let { ExposureProgramEnum.valueOf(it) },
|
|
623
|
+
iso = setting.getString("iso")?.let { IsoEnum.valueOf(it) },
|
|
624
|
+
shutterSpeed = setting.getString("shutterSpeed")?.let { ShutterSpeedEnum.valueOf(it) },
|
|
625
|
+
whiteBalance = setting.getString("whiteBalance")?.let { WhiteBalanceEnum.valueOf(it) },
|
|
626
|
+
)
|
|
627
|
+
)
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return autoBracket
|
|
631
|
+
}
|
|
632
|
+
|
|
559
633
|
fun toProxy(map: ReadableMap?): Proxy? {
|
|
560
634
|
return map?.let {
|
|
561
635
|
Proxy(
|
|
@@ -4,7 +4,6 @@ import com.facebook.react.bridge.*
|
|
|
4
4
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
5
5
|
import com.ricoh360.thetaclient.ThetaRepository
|
|
6
6
|
import com.ricoh360.thetaclient.capture.*
|
|
7
|
-
import io.ktor.utils.io.core.*
|
|
8
7
|
import kotlinx.coroutines.*
|
|
9
8
|
import java.util.*
|
|
10
9
|
import kotlin.coroutines.*
|
|
@@ -35,6 +34,9 @@ class ThetaClientReactNativeModule(
|
|
|
35
34
|
var shotCountSpecifiedIntervalCaptureBuilder: ShotCountSpecifiedIntervalCapture.Builder? = null
|
|
36
35
|
var shotCountSpecifiedIntervalCapture: ShotCountSpecifiedIntervalCapture? = null
|
|
37
36
|
var shotCountSpecifiedIntervalCapturing: ShotCountSpecifiedIntervalCapturing? = null
|
|
37
|
+
var compositeIntervalCaptureBuilder: CompositeIntervalCapture.Builder? = null
|
|
38
|
+
var compositeIntervalCapture: CompositeIntervalCapture? = null
|
|
39
|
+
var compositeIntervalCapturing: CompositeIntervalCapturing? = null
|
|
38
40
|
var theta: ThetaRepository? = null
|
|
39
41
|
var listenerCount: Int = 0
|
|
40
42
|
|
|
@@ -97,6 +99,9 @@ class ThetaClientReactNativeModule(
|
|
|
97
99
|
shotCountSpecifiedIntervalCaptureBuilder = null
|
|
98
100
|
shotCountSpecifiedIntervalCapture = null
|
|
99
101
|
shotCountSpecifiedIntervalCapturing = null
|
|
102
|
+
compositeIntervalCaptureBuilder = null
|
|
103
|
+
compositeIntervalCapture = null
|
|
104
|
+
compositeIntervalCapturing = null
|
|
100
105
|
|
|
101
106
|
theta = ThetaRepository.newInstance(
|
|
102
107
|
endpoint,
|
|
@@ -595,7 +600,7 @@ class ThetaClientReactNativeModule(
|
|
|
595
600
|
return
|
|
596
601
|
}
|
|
597
602
|
class StartCaptureCallback : TimeShiftCapture.StartCaptureCallback {
|
|
598
|
-
override fun
|
|
603
|
+
override fun onCaptureCompleted(fileUrl: String?) {
|
|
599
604
|
promise.resolve(fileUrl)
|
|
600
605
|
timeShiftCapture = null
|
|
601
606
|
}
|
|
@@ -606,10 +611,19 @@ class ThetaClientReactNativeModule(
|
|
|
606
611
|
)
|
|
607
612
|
}
|
|
608
613
|
|
|
609
|
-
override fun
|
|
614
|
+
override fun onCaptureFailed(exception: ThetaRepository.ThetaRepositoryException) {
|
|
610
615
|
promise.reject(exception)
|
|
611
616
|
timeShiftCapture = null
|
|
612
617
|
}
|
|
618
|
+
|
|
619
|
+
override fun onStopFailed(exception: ThetaRepository.ThetaRepositoryException) {
|
|
620
|
+
sendNotifyEvent(
|
|
621
|
+
toNotify(
|
|
622
|
+
NOTIFY_TIMESHIFT_STOP_ERROR,
|
|
623
|
+
toMessageNotifyParam(exception.message ?: exception.toString())
|
|
624
|
+
)
|
|
625
|
+
)
|
|
626
|
+
}
|
|
613
627
|
}
|
|
614
628
|
timeShiftCapturing = timeShiftCapture?.startCapture(StartCaptureCallback())
|
|
615
629
|
}
|
|
@@ -938,6 +952,119 @@ class ThetaClientReactNativeModule(
|
|
|
938
952
|
promise.resolve(true)
|
|
939
953
|
}
|
|
940
954
|
|
|
955
|
+
/**
|
|
956
|
+
* getCompositeIntervalCaptureBuilder - get interval composite shooting builder from repository
|
|
957
|
+
* @param shootingTimeSec Shooting time for interval composite shooting (sec)
|
|
958
|
+
* @param promise Promise for getCompositeIntervalCaptureBuilder
|
|
959
|
+
*/
|
|
960
|
+
@ReactMethod
|
|
961
|
+
fun getCompositeIntervalCaptureBuilder(shootingTimeSec: Int, promise: Promise) {
|
|
962
|
+
val theta = theta
|
|
963
|
+
if (theta == null) {
|
|
964
|
+
promise.reject(Exception(messageNotInit))
|
|
965
|
+
return
|
|
966
|
+
}
|
|
967
|
+
compositeIntervalCaptureBuilder = theta.getCompositeIntervalCaptureBuilder(shootingTimeSec)
|
|
968
|
+
promise.resolve(true)
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* buildCompositeIntervalCapture - build interval composite shooting
|
|
973
|
+
* @param options option to execute interval shooting with the shot count specified
|
|
974
|
+
* @param promise Promise for buildCompositeIntervalCapture
|
|
975
|
+
*/
|
|
976
|
+
@ReactMethod
|
|
977
|
+
fun buildCompositeIntervalCapture(options: ReadableMap, promise: Promise) {
|
|
978
|
+
if (theta == null) {
|
|
979
|
+
promise.reject(Exception(messageNotInit))
|
|
980
|
+
return
|
|
981
|
+
}
|
|
982
|
+
if (compositeIntervalCaptureBuilder == null) {
|
|
983
|
+
promise.reject(Exception("no compositeIntervalCaptureBuilder"))
|
|
984
|
+
return
|
|
985
|
+
}
|
|
986
|
+
launch {
|
|
987
|
+
try {
|
|
988
|
+
compositeIntervalCaptureBuilder?.let {
|
|
989
|
+
setCaptureBuilderParams(optionMap = options, builder = it)
|
|
990
|
+
setCompositeIntervalCaptureBuilderParams(optionMap = options, builder = it)
|
|
991
|
+
compositeIntervalCapture = it.build()
|
|
992
|
+
}
|
|
993
|
+
promise.resolve(true)
|
|
994
|
+
compositeIntervalCaptureBuilder = null
|
|
995
|
+
} catch (t: Throwable) {
|
|
996
|
+
promise.reject(t)
|
|
997
|
+
compositeIntervalCaptureBuilder = null
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* startCompositeIntervalCapture - start interval composite shooting
|
|
1004
|
+
* @param promise promise for startCompositeIntervalCapture
|
|
1005
|
+
*/
|
|
1006
|
+
@ReactMethod
|
|
1007
|
+
fun startCompositeIntervalCapture(promise: Promise) {
|
|
1008
|
+
if (theta == null) {
|
|
1009
|
+
promise.reject(Exception(messageNotInit))
|
|
1010
|
+
return
|
|
1011
|
+
}
|
|
1012
|
+
if (compositeIntervalCapture == null) {
|
|
1013
|
+
promise.reject(Exception("no compositeIntervalCapture"))
|
|
1014
|
+
return
|
|
1015
|
+
}
|
|
1016
|
+
class StartCaptureCallback : CompositeIntervalCapture.StartCaptureCallback {
|
|
1017
|
+
override fun onCaptureCompleted(fileUrls: List<String>?) {
|
|
1018
|
+
promise.resolve(fileUrls?.let {
|
|
1019
|
+
val resultList = Arguments.createArray()
|
|
1020
|
+
it.forEach {
|
|
1021
|
+
resultList.pushString(it)
|
|
1022
|
+
}
|
|
1023
|
+
resultList
|
|
1024
|
+
})
|
|
1025
|
+
compositeIntervalCapture = null
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
override fun onProgress(completion: Float) {
|
|
1029
|
+
sendNotifyEvent(
|
|
1030
|
+
toNotify(
|
|
1031
|
+
NOTIFY_COMPOSITE_INTERVAL_PROGRESS,
|
|
1032
|
+
toCaptureProgressNotifyParam(value = completion)
|
|
1033
|
+
)
|
|
1034
|
+
)
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
override fun onStopFailed(exception: ThetaRepository.ThetaRepositoryException) {
|
|
1038
|
+
sendNotifyEvent(
|
|
1039
|
+
toNotify(
|
|
1040
|
+
NOTIFY_COMPOSITE_INTERVAL_STOP_ERROR,
|
|
1041
|
+
toMessageNotifyParam(exception.message ?: exception.toString())
|
|
1042
|
+
)
|
|
1043
|
+
)
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
override fun onCaptureFailed(exception: ThetaRepository.ThetaRepositoryException) {
|
|
1047
|
+
promise.reject(exception)
|
|
1048
|
+
compositeIntervalCapture = null
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
compositeIntervalCapturing = compositeIntervalCapture?.startCapture(StartCaptureCallback())
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* cancelCompositeIntervalCapture - stop interval composite shooting
|
|
1056
|
+
* @param promise promise for cancelCompositeIntervalCapture
|
|
1057
|
+
*/
|
|
1058
|
+
@ReactMethod
|
|
1059
|
+
fun cancelCompositeIntervalCapture(promise: Promise) {
|
|
1060
|
+
if (theta == null) {
|
|
1061
|
+
promise.reject(Exception(messageNotInit))
|
|
1062
|
+
return
|
|
1063
|
+
}
|
|
1064
|
+
compositeIntervalCapturing?.cancelCapture()
|
|
1065
|
+
promise.resolve(true)
|
|
1066
|
+
}
|
|
1067
|
+
|
|
941
1068
|
/**
|
|
942
1069
|
* getMetadata - retrieve meta data from THETA via repository
|
|
943
1070
|
* @param promise promise to set result
|
|
@@ -1546,9 +1673,12 @@ class ThetaClientReactNativeModule(
|
|
|
1546
1673
|
const val EVENT_NAME = "ThetaFrameEvent"
|
|
1547
1674
|
const val EVENT_NOTIFY = "ThetaNotify"
|
|
1548
1675
|
const val NOTIFY_TIMESHIFT_PROGRESS = "TIME-SHIFT-PROGRESS"
|
|
1676
|
+
const val NOTIFY_TIMESHIFT_STOP_ERROR = "TIME-SHIFT-STOP-ERROR"
|
|
1549
1677
|
const val NOTIFY_VIDEO_CAPTURE_STOP_ERROR = "VIDEO-CAPTURE-STOP-ERROR"
|
|
1550
1678
|
const val NOTIFY_LIMITLESS_INTERVAL_CAPTURE_STOP_ERROR = "LIMITLESS-INTERVAL-CAPTURE-STOP-ERROR"
|
|
1551
1679
|
const val NOTIFY_SHOT_COUNT_SPECIFIED_INTERVAL_PROGRESS = "SHOT-COUNT-SPECIFIED-INTERVAL-PROGRESS"
|
|
1552
1680
|
const val NOTIFY_SHOT_COUNT_SPECIFIED_INTERVAL_STOP_ERROR = "SHOT-COUNT-SPECIFIED-INTERVAL-STOP-ERROR"
|
|
1681
|
+
const val NOTIFY_COMPOSITE_INTERVAL_PROGRESS = "COMPOSITE-INTERVAL-PROGRESS"
|
|
1682
|
+
const val NOTIFY_COMPOSITE_INTERVAL_STOP_ERROR = "COMPOSITE-INTERVAL-STOP-ERROR"
|
|
1553
1683
|
}
|
|
1554
1684
|
}
|
package/ios/ConvertUtil.swift
CHANGED
|
@@ -19,6 +19,7 @@ let KEY_THETA_MODEL = "thetaModel"
|
|
|
19
19
|
let KEY_TIMESHIFT = "timeShift"
|
|
20
20
|
let KEY_APERTURE = "aperture"
|
|
21
21
|
let KEY_CAPTURE_INTERVAL = "captureInterval"
|
|
22
|
+
let KEY_COMPOSITE_SHOOTING_OUTPUT_INTERVAL = "compositeShootingOutputInterval"
|
|
22
23
|
let KEY_COLOR_TEMPERATURE = "colorTemperature"
|
|
23
24
|
let KEY_EXPOSURE_COMPENSATION = "exposureCompensation"
|
|
24
25
|
let KEY_EXPOSURE_DELAY = "exposureDelay"
|
|
@@ -65,6 +66,7 @@ let optionItemNameToEnum = [
|
|
|
65
66
|
// TODO: Add items when adding options
|
|
66
67
|
"aiAutoThumbnail": ThetaRepository.OptionNameEnum.aiautothumbnail,
|
|
67
68
|
"aperture": ThetaRepository.OptionNameEnum.aperture,
|
|
69
|
+
"autoBracket": ThetaRepository.OptionNameEnum.autobracket,
|
|
68
70
|
"bitrate": ThetaRepository.OptionNameEnum.bitrate,
|
|
69
71
|
"bluetoothPower": ThetaRepository.OptionNameEnum.bluetoothpower,
|
|
70
72
|
"burstMode": ThetaRepository.OptionNameEnum.burstmode,
|
|
@@ -162,6 +164,10 @@ func setOptionsValue(options: ThetaRepository.Options, name: String, value: Any)
|
|
|
162
164
|
options.aperture = getEnumValue(
|
|
163
165
|
values: ThetaRepository.ApertureEnum.values(), name: value as! String
|
|
164
166
|
)!
|
|
167
|
+
case ThetaRepository.OptionNameEnum.autobracket.name:
|
|
168
|
+
if let params = value as? [[String: Any]] {
|
|
169
|
+
options.autoBracket = toAutoBracket(params: params)
|
|
170
|
+
}
|
|
165
171
|
case ThetaRepository.OptionNameEnum.bitrate.name:
|
|
166
172
|
options.bitrate = toBitrate(value: value)
|
|
167
173
|
case ThetaRepository.OptionNameEnum.bluetoothpower.name:
|
|
@@ -360,6 +366,10 @@ func convertResult(options: ThetaRepository.Options) -> [String: Any] {
|
|
|
360
366
|
result[key] = value as! Bool ? true : false
|
|
361
367
|
} else if value is NSNumber || value is String {
|
|
362
368
|
result[key] = value
|
|
369
|
+
} else if value is ThetaRepository.BracketSettingList,
|
|
370
|
+
let autoBracket = value as? ThetaRepository.BracketSettingList
|
|
371
|
+
{
|
|
372
|
+
result[key] = convertResult(autoBracket: autoBracket)
|
|
363
373
|
} else if let bitrate = value as? ThetaRepository.BitrateNumber {
|
|
364
374
|
result[key] = bitrate.value
|
|
365
375
|
} else if value is ThetaRepository.BurstOption,
|
|
@@ -558,6 +568,17 @@ func setShotCountSpecifiedIntervalCaptureBuilderParams(params: [String: Any], bu
|
|
|
558
568
|
}
|
|
559
569
|
}
|
|
560
570
|
|
|
571
|
+
func setCompositeIntervalCaptureBuilderParams(params: [String: Any], builder: CompositeIntervalCapture.Builder) {
|
|
572
|
+
if let interval = params[KEY_TIMESHIFT_CAPTURE_INTERVAL] as? Int,
|
|
573
|
+
interval >= 0
|
|
574
|
+
{
|
|
575
|
+
builder.setCheckStatusCommandInterval(timeMillis: Int64(interval))
|
|
576
|
+
}
|
|
577
|
+
if let value = params[KEY_COMPOSITE_SHOOTING_OUTPUT_INTERVAL] as? Int32 {
|
|
578
|
+
builder.setCompositeShootingOutputInterval(sec: value)
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
561
582
|
// MARK: - Utility
|
|
562
583
|
|
|
563
584
|
func getEnumValue<T, E: KotlinEnum<T>>(values: KotlinArray<E>, name: String) -> E? {
|
|
@@ -742,6 +763,40 @@ func convertResult(burstOption: ThetaRepository.BurstOption) -> [String: Any] {
|
|
|
742
763
|
return result
|
|
743
764
|
}
|
|
744
765
|
|
|
766
|
+
func convertResult(autoBracket: ThetaRepository.BracketSettingList) -> [[String: Any]] {
|
|
767
|
+
var resultList = [[String: Any]]()
|
|
768
|
+
|
|
769
|
+
autoBracket.list.forEach { bracketSetting in
|
|
770
|
+
var result: [String: Any] = [:]
|
|
771
|
+
if let setting = bracketSetting as? ThetaRepository.BracketSetting {
|
|
772
|
+
if let aperture = setting.aperture?.name {
|
|
773
|
+
result["aperture"] = aperture
|
|
774
|
+
}
|
|
775
|
+
if let colorTemperature = setting.colorTemperature?.intValue {
|
|
776
|
+
result["colorTemperature"] = colorTemperature
|
|
777
|
+
}
|
|
778
|
+
if let exposureCompensation = setting.exposureCompensation?.name {
|
|
779
|
+
result["exposureCompensation"] = exposureCompensation
|
|
780
|
+
}
|
|
781
|
+
if let exposureProgram = setting.exposureProgram?.name {
|
|
782
|
+
result["exposureProgram"] = exposureProgram
|
|
783
|
+
}
|
|
784
|
+
if let iso = setting.iso?.name {
|
|
785
|
+
result["iso"] = iso
|
|
786
|
+
}
|
|
787
|
+
if let shutterSpeed = setting.shutterSpeed?.name {
|
|
788
|
+
result["shutterSpeed"] = shutterSpeed
|
|
789
|
+
}
|
|
790
|
+
if let whiteBalance = setting.whiteBalance?.name {
|
|
791
|
+
result["whiteBalance"] = whiteBalance
|
|
792
|
+
}
|
|
793
|
+
resultList.append(result)
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
return resultList
|
|
798
|
+
}
|
|
799
|
+
|
|
745
800
|
func convertResult(gpsInfo: ThetaRepository.GpsInfo) -> [String: Any] {
|
|
746
801
|
return [
|
|
747
802
|
"latitude": gpsInfo.latitude,
|
|
@@ -941,6 +996,80 @@ func toBurstOption(params: [String: Any]) -> ThetaRepository.BurstOption {
|
|
|
941
996
|
)
|
|
942
997
|
}
|
|
943
998
|
|
|
999
|
+
func toAutoBracket(params: [[String: Any]]) -> ThetaRepository.BracketSettingList {
|
|
1000
|
+
let autoBracket = ThetaRepository.BracketSettingList(list: NSMutableArray())
|
|
1001
|
+
|
|
1002
|
+
params.forEach { map in
|
|
1003
|
+
let aperture = {
|
|
1004
|
+
if let name = map["aperture"] as? String {
|
|
1005
|
+
return getEnumValue(values: ThetaRepository.ApertureEnum.values(), name: name)
|
|
1006
|
+
} else {
|
|
1007
|
+
return nil
|
|
1008
|
+
}
|
|
1009
|
+
}()
|
|
1010
|
+
|
|
1011
|
+
let colorTemperature = {
|
|
1012
|
+
if let value = map["colorTemperature"] as? Int {
|
|
1013
|
+
return toKotlinInt(value: value)
|
|
1014
|
+
} else {
|
|
1015
|
+
return nil
|
|
1016
|
+
}
|
|
1017
|
+
}()
|
|
1018
|
+
|
|
1019
|
+
let exposureCompensation = {
|
|
1020
|
+
if let name = map["exposureCompensation"] as? String {
|
|
1021
|
+
return getEnumValue(values: ThetaRepository.ExposureCompensationEnum.values(), name: name)
|
|
1022
|
+
} else {
|
|
1023
|
+
return nil
|
|
1024
|
+
}
|
|
1025
|
+
}()
|
|
1026
|
+
|
|
1027
|
+
let exposureProgram = {
|
|
1028
|
+
if let name = map["exposureProgram"] as? String {
|
|
1029
|
+
return getEnumValue(values: ThetaRepository.ExposureProgramEnum.values(), name: name)
|
|
1030
|
+
} else {
|
|
1031
|
+
return nil
|
|
1032
|
+
}
|
|
1033
|
+
}()
|
|
1034
|
+
|
|
1035
|
+
let iso = {
|
|
1036
|
+
if let name = map["iso"] as? String {
|
|
1037
|
+
return getEnumValue(values: ThetaRepository.IsoEnum.values(), name: name)
|
|
1038
|
+
} else {
|
|
1039
|
+
return nil
|
|
1040
|
+
}
|
|
1041
|
+
}()
|
|
1042
|
+
|
|
1043
|
+
let shutterSpeed = {
|
|
1044
|
+
if let name = map["shutterSpeed"] as? String {
|
|
1045
|
+
return getEnumValue(values: ThetaRepository.ShutterSpeedEnum.values(), name: name)
|
|
1046
|
+
} else {
|
|
1047
|
+
return nil
|
|
1048
|
+
}
|
|
1049
|
+
}()
|
|
1050
|
+
|
|
1051
|
+
let whiteBalance = {
|
|
1052
|
+
if let name = map["whiteBalance"] as? String {
|
|
1053
|
+
return getEnumValue(values: ThetaRepository.WhiteBalanceEnum.values(), name: name)
|
|
1054
|
+
} else {
|
|
1055
|
+
return nil
|
|
1056
|
+
}
|
|
1057
|
+
}()
|
|
1058
|
+
|
|
1059
|
+
autoBracket.add(setting: ThetaRepository.BracketSetting(
|
|
1060
|
+
aperture: aperture,
|
|
1061
|
+
colorTemperature: colorTemperature,
|
|
1062
|
+
exposureCompensation: exposureCompensation,
|
|
1063
|
+
exposureProgram: exposureProgram,
|
|
1064
|
+
iso: iso,
|
|
1065
|
+
shutterSpeed: shutterSpeed,
|
|
1066
|
+
whiteBalance: whiteBalance
|
|
1067
|
+
))
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
return autoBracket
|
|
1071
|
+
}
|
|
1072
|
+
|
|
944
1073
|
func toGpsInfo(params: [String: Any]) -> ThetaRepository.GpsInfo? {
|
|
945
1074
|
guard let latitude = params[KEY_GPS_LATITUDE] as? Double,
|
|
946
1075
|
let longitude = params[KEY_GPS_LONGITUDE] as? Double,
|
|
@@ -121,6 +121,20 @@ RCT_EXTERN_METHOD(startShotCountSpecifiedIntervalCapture:(RCTPromiseResolveBlock
|
|
|
121
121
|
RCT_EXTERN_METHOD(cancelShotCountSpecifiedIntervalCapture:(RCTPromiseResolveBlock)resolve
|
|
122
122
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
123
123
|
|
|
124
|
+
RCT_EXTERN_METHOD(getCompositeIntervalCaptureBuilder:(int)shootingTimeSec
|
|
125
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
126
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
127
|
+
|
|
128
|
+
RCT_EXTERN_METHOD(buildCompositeIntervalCapture:(NSDictionary*)options
|
|
129
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
130
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
131
|
+
|
|
132
|
+
RCT_EXTERN_METHOD(startCompositeIntervalCapture:(RCTPromiseResolveBlock)resolve
|
|
133
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
134
|
+
|
|
135
|
+
RCT_EXTERN_METHOD(cancelCompositeIntervalCapture:(RCTPromiseResolveBlock)resolve
|
|
136
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
137
|
+
|
|
124
138
|
RCT_EXTERN_METHOD(getMetadata:(NSString*)fileUrl
|
|
125
139
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
126
140
|
withRejecter:(RCTPromiseRejectBlock)reject)
|