theta-client-react-native 1.4.0 → 1.5.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.
Files changed (88) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +436 -1111
  3. package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +292 -252
  4. package/ios/ConvertUtil.swift +66 -2
  5. package/ios/ThetaClientReactNative.m +27 -0
  6. package/ios/ThetaClientReactNative.swift +273 -2
  7. package/lib/commonjs/capture/index.js +22 -0
  8. package/lib/commonjs/capture/index.js.map +1 -1
  9. package/lib/commonjs/capture/limitless-interval-capture.js +89 -0
  10. package/lib/commonjs/capture/limitless-interval-capture.js.map +1 -0
  11. package/lib/commonjs/capture/photo-capture.js +7 -2
  12. package/lib/commonjs/capture/photo-capture.js.map +1 -1
  13. package/lib/commonjs/capture/shot-count-specified-interval-capture.js +112 -0
  14. package/lib/commonjs/capture/shot-count-specified-interval-capture.js.map +1 -0
  15. package/lib/commonjs/theta-repository/options/index.js +44 -0
  16. package/lib/commonjs/theta-repository/options/index.js.map +1 -1
  17. package/lib/commonjs/theta-repository/options/option-top-bottom-correction-rotation.js +2 -0
  18. package/lib/commonjs/theta-repository/options/option-top-bottom-correction-rotation.js.map +1 -0
  19. package/lib/commonjs/theta-repository/options/option-top-bottom-correction.js +52 -0
  20. package/lib/commonjs/theta-repository/options/option-top-bottom-correction.js.map +1 -0
  21. package/lib/commonjs/theta-repository/options/option-video-stitching.js +24 -0
  22. package/lib/commonjs/theta-repository/options/option-video-stitching.js.map +1 -0
  23. package/lib/commonjs/theta-repository/options/option-visibility-reduction.js +23 -0
  24. package/lib/commonjs/theta-repository/options/option-visibility-reduction.js.map +1 -0
  25. package/lib/commonjs/theta-repository/options/options.js +10 -0
  26. package/lib/commonjs/theta-repository/options/options.js.map +1 -1
  27. package/lib/commonjs/theta-repository/theta-repository.js +24 -1
  28. package/lib/commonjs/theta-repository/theta-repository.js.map +1 -1
  29. package/lib/module/capture/index.js +2 -0
  30. package/lib/module/capture/index.js.map +1 -1
  31. package/lib/module/capture/limitless-interval-capture.js +81 -0
  32. package/lib/module/capture/limitless-interval-capture.js.map +1 -0
  33. package/lib/module/capture/photo-capture.js +7 -2
  34. package/lib/module/capture/photo-capture.js.map +1 -1
  35. package/lib/module/capture/shot-count-specified-interval-capture.js +104 -0
  36. package/lib/module/capture/shot-count-specified-interval-capture.js.map +1 -0
  37. package/lib/module/theta-repository/options/index.js +4 -0
  38. package/lib/module/theta-repository/options/index.js.map +1 -1
  39. package/lib/module/theta-repository/options/option-top-bottom-correction-rotation.js +2 -0
  40. package/lib/module/theta-repository/options/option-top-bottom-correction-rotation.js.map +1 -0
  41. package/lib/module/theta-repository/options/option-top-bottom-correction.js +45 -0
  42. package/lib/module/theta-repository/options/option-top-bottom-correction.js.map +1 -0
  43. package/lib/module/theta-repository/options/option-video-stitching.js +17 -0
  44. package/lib/module/theta-repository/options/option-video-stitching.js.map +1 -0
  45. package/lib/module/theta-repository/options/option-visibility-reduction.js +16 -0
  46. package/lib/module/theta-repository/options/option-visibility-reduction.js.map +1 -0
  47. package/lib/module/theta-repository/options/options.js +10 -0
  48. package/lib/module/theta-repository/options/options.js.map +1 -1
  49. package/lib/module/theta-repository/theta-repository.js +23 -2
  50. package/lib/module/theta-repository/theta-repository.js.map +1 -1
  51. package/lib/typescript/capture/index.d.ts +2 -0
  52. package/lib/typescript/capture/index.d.ts.map +1 -1
  53. package/lib/typescript/capture/limitless-interval-capture.d.ts +40 -0
  54. package/lib/typescript/capture/limitless-interval-capture.d.ts.map +1 -0
  55. package/lib/typescript/capture/photo-capture.d.ts +1 -1
  56. package/lib/typescript/capture/photo-capture.d.ts.map +1 -1
  57. package/lib/typescript/capture/shot-count-specified-interval-capture.d.ts +47 -0
  58. package/lib/typescript/capture/shot-count-specified-interval-capture.d.ts.map +1 -0
  59. package/lib/typescript/theta-repository/options/index.d.ts +4 -0
  60. package/lib/typescript/theta-repository/options/index.d.ts.map +1 -1
  61. package/lib/typescript/theta-repository/options/option-top-bottom-correction-rotation.d.ts +22 -0
  62. package/lib/typescript/theta-repository/options/option-top-bottom-correction-rotation.d.ts.map +1 -0
  63. package/lib/typescript/theta-repository/options/option-top-bottom-correction.d.ts +45 -0
  64. package/lib/typescript/theta-repository/options/option-top-bottom-correction.d.ts.map +1 -0
  65. package/lib/typescript/theta-repository/options/option-video-stitching.d.ts +17 -0
  66. package/lib/typescript/theta-repository/options/option-video-stitching.d.ts.map +1 -0
  67. package/lib/typescript/theta-repository/options/option-visibility-reduction.d.ts +16 -0
  68. package/lib/typescript/theta-repository/options/option-visibility-reduction.d.ts.map +1 -0
  69. package/lib/typescript/theta-repository/options/options.d.ts +27 -0
  70. package/lib/typescript/theta-repository/options/options.d.ts.map +1 -1
  71. package/lib/typescript/theta-repository/theta-repository.d.ts +17 -2
  72. package/lib/typescript/theta-repository/theta-repository.d.ts.map +1 -1
  73. package/lib/typescript/theta-repository/theta-state.d.ts +1 -1
  74. package/lib/typescript/theta-repository/theta-state.d.ts.map +1 -1
  75. package/package.json +4 -2
  76. package/src/capture/index.ts +2 -0
  77. package/src/capture/limitless-interval-capture.ts +99 -0
  78. package/src/capture/photo-capture.ts +7 -2
  79. package/src/capture/shot-count-specified-interval-capture.ts +146 -0
  80. package/src/theta-repository/options/index.ts +4 -0
  81. package/src/theta-repository/options/option-top-bottom-correction-rotation.ts +21 -0
  82. package/src/theta-repository/options/option-top-bottom-correction.ts +46 -0
  83. package/src/theta-repository/options/option-video-stitching.ts +18 -0
  84. package/src/theta-repository/options/option-visibility-reduction.ts +17 -0
  85. package/src/theta-repository/options/options.ts +27 -0
  86. package/src/theta-repository/theta-repository.ts +26 -1
  87. package/src/theta-repository/theta-state.ts +1 -1
  88. package/theta-client-react-native.podspec +1 -1
@@ -29,6 +29,12 @@ class ThetaClientReactNativeModule(
29
29
  var videoCaptureBuilder: VideoCapture.Builder? = null
30
30
  var videoCapture: VideoCapture? = null
31
31
  var videoCapturing: VideoCapturing? = null
32
+ var limitlessIntervalCaptureBuilder: LimitlessIntervalCapture.Builder? = null
33
+ var limitlessIntervalCapture: LimitlessIntervalCapture? = null
34
+ var limitlessIntervalCapturing: LimitlessIntervalCapturing? = null
35
+ var shotCountSpecifiedIntervalCaptureBuilder: ShotCountSpecifiedIntervalCapture.Builder? = null
36
+ var shotCountSpecifiedIntervalCapture: ShotCountSpecifiedIntervalCapture? = null
37
+ var shotCountSpecifiedIntervalCapturing: ShotCountSpecifiedIntervalCapturing? = null
32
38
  var theta: ThetaRepository? = null
33
39
  var listenerCount: Int = 0
34
40
 
@@ -85,6 +91,12 @@ class ThetaClientReactNativeModule(
85
91
  videoCaptureBuilder = null
86
92
  videoCapture = null
87
93
  videoCapturing = null
94
+ limitlessIntervalCaptureBuilder = null
95
+ limitlessIntervalCapture = null
96
+ limitlessIntervalCapturing = null
97
+ shotCountSpecifiedIntervalCaptureBuilder = null
98
+ shotCountSpecifiedIntervalCapture = null
99
+ shotCountSpecifiedIntervalCapturing = null
88
100
 
89
101
  theta = ThetaRepository.newInstance(
90
102
  endpoint,
@@ -249,7 +261,7 @@ class ThetaClientReactNativeModule(
249
261
  )
250
262
  val resultList = Arguments.createArray()
251
263
  fileList.forEach {
252
- resultList.pushMap(fileInfoFromTheta(it))
264
+ resultList.pushMap(toResult(fileInfo = it))
253
265
  }
254
266
  val resultMap = Arguments.createMap()
255
267
  resultMap.putArray("fileList", resultList)
@@ -350,117 +362,6 @@ class ThetaClientReactNativeModule(
350
362
  }
351
363
  }
352
364
 
353
- /** option converter */
354
- private val converters = mapOf(
355
- "aiAutoThumbnail" to AiAutoThumbnailConverter(),
356
- "aperture" to ApertureConverter(),
357
- "bitrate" to BitrateConverter(),
358
- "bluetoothPower" to BluetoothPowerConverter(),
359
- "burstMode" to BurstModeConverter(),
360
- "burstOption" to BurstOptionConverter(),
361
- "cameraControlSource" to CameraControlSourceConverter(),
362
- "cameraMode" to CameraModeConverter(),
363
- "captureInterval" to CaptureIntervalConverter(),
364
- "captureMode" to CaptureModeConverter(),
365
- "captureNumber" to CaptureNumberConverter(),
366
- "colorTemperature" to ColorTemperatureConverter(),
367
- "compositeShootingOutputInterval" to CompositeShootingOutputIntervalConverter(),
368
- "compositeShootingTime" to CompositeShootingTimeConverter(),
369
- "continuousNumber" to ContinuousNumberConverter(),
370
- "dateTimeZone" to DateTimeZoneConverter(),
371
- "exposureCompensation" to ExposureCompensationConverter(),
372
- "exposureDelay" to ExposureDelayConverter(),
373
- "exposureProgram" to ExposureProgramConverter(),
374
- "faceDetect" to FaceDetectConverter(),
375
- "fileFormat" to FileFormatConverter(),
376
- "filter" to FilterConverter(),
377
- "function" to FunctionConverter(),
378
- "gain" to GainConverter(),
379
- "gpsInfo" to GpsInfoConverter(),
380
- "imageStitching" to ImageStitchingConverter(),
381
- "isGpsOn" to IsGpsOnConverter(),
382
- "iso" to IsoConverter(),
383
- "isoAutoHighLimit" to IsoAutoHighLimitConverter(),
384
- "language" to LanguageConverter(),
385
- "maxRecordableTime" to MaxRecordableTimeConverter(),
386
- "networkType" to NetworkTypeConverter(),
387
- "offDelay" to OffDelayConverter(),
388
- "password" to PasswordConverter(),
389
- "powerSaving" to PowerSavingConverter(),
390
- "preset" to PresetConverter(),
391
- "previewFormat" to PreviewFormatConverter(),
392
- "proxy" to ProxyConverter(),
393
- "remainingPictures" to RemainingPicturesConverter(),
394
- "remainingVideoSeconds" to RemainingVideoSecondsConverter(),
395
- "remainingSpace" to RemainingSpaceConverter(),
396
- "shootingMethod" to ShootingMethodConverter(),
397
- "shutterSpeed" to ShutterSpeedConverter(),
398
- "shutterVolume" to ShutterVolumeConverter(),
399
- "sleepDelay" to SleepDelayConverter(),
400
- "timeShift" to TimeShiftConverter(),
401
- "totalSpace" to TotalSpaceConverter(),
402
- "username" to UsernameConverter(),
403
- "whiteBalance" to WhiteBalanceConverter(),
404
- "whiteBalanceAutoStrength" to WhiteBalanceAutoStrengthConverter(),
405
- "wlanFrequency" to WlanFrequencyConverter(),
406
- "_gpsTagRecording" to GpsTagRecordingConverter(),
407
- )
408
-
409
- /** OptionNameEnum to option */
410
- private val optionEnumToOption = mapOf(
411
- "AiAutoThumbnail" to "aiAutoThumbnail",
412
- "Aperture" to "aperture",
413
- "Bitrate" to "bitrate",
414
- "BluetoothPower" to "bluetoothPower",
415
- "BurstMode" to "burstMode",
416
- "BurstOption" to "burstOption",
417
- "CameraControlSource" to "cameraControlSource",
418
- "CameraMode" to "cameraMode",
419
- "CaptureInterval" to "captureInterval",
420
- "CaptureMode" to "captureMode",
421
- "CaptureNumber" to "captureNumber",
422
- "ColorTemperature" to "colorTemperature",
423
- "CompositeShootingOutputInterval" to "compositeShootingOutputInterval",
424
- "CompositeShootingTime" to "compositeShootingTime",
425
- "ContinuousNumber" to "continuousNumber",
426
- "DateTimeZone" to "dateTimeZone",
427
- "ExposureCompensation" to "exposureCompensation",
428
- "ExposureDelay" to "exposureDelay",
429
- "ExposureProgram" to "exposureProgram",
430
- "FaceDetect" to "faceDetect",
431
- "FileFormat" to "fileFormat",
432
- "Filter" to "filter",
433
- "Function" to "function",
434
- "Gain" to "gain",
435
- "GpsInfo" to "gpsInfo",
436
- "ImageStitching" to "imageStitching",
437
- "IsGpsOn" to "isGpsOn",
438
- "Iso" to "iso",
439
- "IsoAutoHighLimit" to "isoAutoHighLimit",
440
- "Language" to "language",
441
- "MaxRecordableTime" to "maxRecordableTime",
442
- "NetworkType" to "networkType",
443
- "OffDelay" to "offDelay",
444
- "Password" to "password",
445
- "PowerSaving" to "powerSaving",
446
- "Preset" to "preset",
447
- "PreviewFormat" to "previewFormat",
448
- "Proxy" to "proxy",
449
- "RemainingPictures" to "remainingPictures",
450
- "RemainingVideoSeconds" to "remainingVideoSeconds",
451
- "RemainingSpace" to "remainingSpace",
452
- "ShootingMethod" to "shootingMethod",
453
- "ShutterSpeed" to "shutterSpeed",
454
- "ShutterVolume" to "shutterVolume",
455
- "SleepDelay" to "sleepDelay",
456
- "TimeShift" to "timeShift",
457
- "TotalSpace" to "totalSpace",
458
- "Username" to "username",
459
- "WhiteBalance" to "whiteBalance",
460
- "WhiteBalanceAutoStrength" to "whiteBalanceAutoStrength",
461
- "WlanFrequency" to "wlanFrequency",
462
- )
463
-
464
365
  /**
465
366
  * getOptions - get options from THETA via repository
466
367
  * @param optionNames option name list to get
@@ -475,18 +376,8 @@ class ThetaClientReactNativeModule(
475
376
  }
476
377
  launch {
477
378
  try {
478
- val optionNameList = mutableListOf<ThetaRepository.OptionNameEnum>()
479
- for (index in 0..(optionNames.size() - 1)) {
480
- val option = optionNames.getString(index)
481
- optionNameList.add(ThetaRepository.OptionNameEnum.valueOf(option))
482
- }
483
- val options = theta.getOptions(optionNameList)
484
- val result = Arguments.createMap()
485
- for (index in 0..(optionNames.size() - 1)) {
486
- val option = optionEnumToOption[optionNames.getString(index)]
487
- val cvt = converters[option]
488
- cvt?.setFromTheta(options, result)
489
- }
379
+ val response = theta.getOptions(toGetOptionsParam(optionNames = optionNames))
380
+ val result = toResult(options = response)
490
381
  promise.resolve(result)
491
382
  } catch (t: Throwable) {
492
383
  promise.reject(t)
@@ -509,14 +400,8 @@ class ThetaClientReactNativeModule(
509
400
  }
510
401
  launch {
511
402
  try {
512
- val thetaOptions = ThetaRepository.Options()
513
- val iterator = options.keySetIterator()
514
- while (iterator.hasNextKey()) {
515
- val key = iterator.nextKey()
516
- val cvt = converters[key]
517
- cvt?.setToTheta(thetaOptions, options)
518
- }
519
- theta.setOptions(thetaOptions)
403
+ val params = toSetOptionsParam(optionsMap = options)
404
+ theta.setOptions(params)
520
405
  promise.resolve(true)
521
406
  } catch (t: Throwable) {
522
407
  promise.reject(t)
@@ -579,11 +464,12 @@ class ThetaClientReactNativeModule(
579
464
  */
580
465
  @ReactMethod
581
466
  fun getPhotoCaptureBuilder(promise: Promise) {
467
+ val theta = theta
582
468
  if (theta == null) {
583
469
  promise.reject(Exception(messageNotInit))
584
470
  return
585
471
  }
586
- photoCaptureBuilder = theta?.getPhotoCaptureBuilder()
472
+ photoCaptureBuilder = theta.getPhotoCaptureBuilder()
587
473
  promise.resolve(true)
588
474
  }
589
475
 
@@ -605,13 +491,11 @@ class ThetaClientReactNativeModule(
605
491
  }
606
492
  launch {
607
493
  try {
608
- val iterator = options.keySetIterator()
609
- while (iterator.hasNextKey()) {
610
- val key = iterator.nextKey()
611
- val cvt = converters[key]
612
- cvt?.setPhotoOption(options, photoCaptureBuilder!!)
494
+ photoCaptureBuilder?.let {
495
+ setCaptureBuilderParams(optionMap = options, builder = it)
496
+ setPhotoCaptureBuilderParams(optionMap = options, builder = it)
497
+ photoCapture = it.build()
613
498
  }
614
- photoCapture = photoCaptureBuilder!!.build()
615
499
  promise.resolve(true)
616
500
  photoCaptureBuilder = null
617
501
  } catch (t: Throwable) {
@@ -636,7 +520,7 @@ class ThetaClientReactNativeModule(
636
520
  return
637
521
  }
638
522
  class TakePictureCallback : PhotoCapture.TakePictureCallback {
639
- override fun onSuccess(fileUrl: String) {
523
+ override fun onSuccess(fileUrl: String?) {
640
524
  promise.resolve(fileUrl)
641
525
  photoCapture = null
642
526
  }
@@ -656,11 +540,12 @@ class ThetaClientReactNativeModule(
656
540
  */
657
541
  @ReactMethod
658
542
  fun getTimeShiftCaptureBuilder(promise: Promise) {
543
+ val theta = theta
659
544
  if (theta == null) {
660
545
  promise.reject(Exception(messageNotInit))
661
546
  return
662
547
  }
663
- timeShiftCaptureBuilder = theta?.getTimeShiftCaptureBuilder()
548
+ timeShiftCaptureBuilder = theta.getTimeShiftCaptureBuilder()
664
549
  promise.resolve(true)
665
550
  }
666
551
 
@@ -675,34 +560,23 @@ class ThetaClientReactNativeModule(
675
560
  promise.reject(Exception(messageNotInit))
676
561
  return
677
562
  }
678
-
679
- timeShiftCaptureBuilder?.let { builder ->
680
- launch {
681
- try {
682
- val iterator = options.keySetIterator()
683
- while (iterator.hasNextKey()) {
684
- val key = iterator.nextKey()
685
- val cvt = converters[key]
686
- cvt?.setTimeShiftOption(options, builder)
687
- }
688
-
689
- val interval = if (options.hasKey("_capture_interval")) options.getInt("_capture_interval") else null
690
- interval?.let {
691
- if (it >= 0) {
692
- builder.setCheckStatusCommandInterval(it.toLong())
693
- }
694
- }
695
-
696
- timeShiftCapture = builder.build()
697
- promise.resolve(true)
698
- timeShiftCaptureBuilder = null
699
- } catch (t: Throwable) {
700
- promise.reject(t)
701
- timeShiftCaptureBuilder = null
563
+ if (timeShiftCaptureBuilder == null) {
564
+ promise.reject(Exception("no timeShiftCaptureBuilder"))
565
+ return
566
+ }
567
+ launch {
568
+ try {
569
+ timeShiftCaptureBuilder?.let {
570
+ setCaptureBuilderParams(optionMap = options, builder = it)
571
+ setTimeShiftCaptureBuilderParams(optionMap = options, builder = it)
572
+ timeShiftCapture = it.build()
702
573
  }
574
+ promise.resolve(true)
575
+ timeShiftCaptureBuilder = null
576
+ } catch (t: Throwable) {
577
+ promise.reject(t)
578
+ timeShiftCaptureBuilder = null
703
579
  }
704
- } ?: run {
705
- promise.reject(Exception("no timeShiftCaptureBuilder"))
706
580
  }
707
581
  }
708
582
 
@@ -716,28 +590,28 @@ class ThetaClientReactNativeModule(
716
590
  promise.reject(Exception(messageNotInit))
717
591
  return
718
592
  }
719
- timeShiftCapture?.let { capture ->
720
- class StartCaptureCallback : TimeShiftCapture.StartCaptureCallback {
721
- override fun onSuccess(fileUrl: String?) {
722
- promise.resolve(fileUrl)
723
- timeShiftCapture = null
724
- }
593
+ if (timeShiftCapture == null) {
594
+ promise.reject(Exception("no timeShiftCapture"))
595
+ return
596
+ }
597
+ class StartCaptureCallback : TimeShiftCapture.StartCaptureCallback {
598
+ override fun onSuccess(fileUrl: String?) {
599
+ promise.resolve(fileUrl)
600
+ timeShiftCapture = null
601
+ }
725
602
 
726
- override fun onProgress(completion: Float) {
727
- sendNotifyEvent(
728
- toNotify(NOTIFY_TIMESHIFT_PROGRESS, toCaptureProgressNotifyParam(value = completion))
729
- )
730
- }
603
+ override fun onProgress(completion: Float) {
604
+ sendNotifyEvent(
605
+ toNotify(NOTIFY_TIMESHIFT_PROGRESS, toCaptureProgressNotifyParam(value = completion))
606
+ )
607
+ }
731
608
 
732
- override fun onError(exception: ThetaRepository.ThetaRepositoryException) {
733
- promise.reject(exception)
734
- timeShiftCapture = null
735
- }
609
+ override fun onError(exception: ThetaRepository.ThetaRepositoryException) {
610
+ promise.reject(exception)
611
+ timeShiftCapture = null
736
612
  }
737
- timeShiftCapturing = capture.startCapture(StartCaptureCallback())
738
- } ?: run {
739
- promise.reject(Exception("no timeShiftCapture"))
740
613
  }
614
+ timeShiftCapturing = timeShiftCapture?.startCapture(StartCaptureCallback())
741
615
  }
742
616
 
743
617
  /**
@@ -758,11 +632,12 @@ class ThetaClientReactNativeModule(
758
632
  */
759
633
  @ReactMethod
760
634
  fun getVideoCaptureBuilder(promise: Promise) {
635
+ val theta = theta
761
636
  if (theta == null) {
762
637
  promise.reject(Exception(messageNotInit))
763
638
  return
764
639
  }
765
- videoCaptureBuilder = theta?.getVideoCaptureBuilder()
640
+ videoCaptureBuilder = theta.getVideoCaptureBuilder()
766
641
  promise.resolve(true)
767
642
  }
768
643
 
@@ -783,13 +658,11 @@ class ThetaClientReactNativeModule(
783
658
  }
784
659
  launch {
785
660
  try {
786
- val iterator = options.keySetIterator()
787
- while (iterator.hasNextKey()) {
788
- val key = iterator.nextKey()
789
- val cvt = converters[key]
790
- cvt?.setVideoOption(options, videoCaptureBuilder!!)
661
+ videoCaptureBuilder?.let {
662
+ setCaptureBuilderParams(optionMap = options, builder = it)
663
+ setVideoCaptureBuilderParams(optionMap = options, builder = it)
664
+ videoCapture = it.build()
791
665
  }
792
- videoCapture = videoCaptureBuilder!!.build()
793
666
  promise.resolve(true)
794
667
  videoCaptureBuilder = null
795
668
  } catch (t: Throwable) {
@@ -835,7 +708,7 @@ class ThetaClientReactNativeModule(
835
708
  )
836
709
  }
837
710
  }
838
- videoCapturing = videoCapture!!.startCapture(StartCaptureCallback())
711
+ videoCapturing = videoCapture?.startCapture(StartCaptureCallback())
839
712
  }
840
713
 
841
714
  /**
@@ -849,6 +722,222 @@ class ThetaClientReactNativeModule(
849
722
  videoCapturing?.stopCapture()
850
723
  }
851
724
 
725
+ /**
726
+ * getLimitlessIntervalCaptureBuilder - get limitless interval capture builder
727
+ * @param promise promise to set result
728
+ */
729
+ @ReactMethod
730
+ fun getLimitlessIntervalCaptureBuilder(promise: Promise) {
731
+ val theta = theta
732
+ if (theta == null) {
733
+ promise.reject(Exception(messageNotInit))
734
+ return
735
+ }
736
+ limitlessIntervalCaptureBuilder = theta.getLimitlessIntervalCaptureBuilder()
737
+ promise.resolve(true)
738
+ }
739
+
740
+ /**
741
+ * buildLimitlessIntervalCapture - build limitless interval capture
742
+ * @param options option to capture limitless interval
743
+ * @param promise promise to set result
744
+ */
745
+ @ReactMethod
746
+ fun buildLimitlessIntervalCapture(options: ReadableMap, promise: Promise) {
747
+ if (theta == null) {
748
+ promise.reject(Exception(messageNotInit))
749
+ return
750
+ }
751
+ if (limitlessIntervalCaptureBuilder == null) {
752
+ promise.reject(Exception("no limitlessIntervalCaptureBuilder"))
753
+ return
754
+ }
755
+ launch {
756
+ try {
757
+ limitlessIntervalCaptureBuilder?.let {
758
+ setCaptureBuilderParams(optionMap = options, builder = it)
759
+ setLimitlessIntervalCaptureBuilderParams(optionMap = options, builder = it)
760
+ limitlessIntervalCapture = it.build()
761
+ }
762
+ promise.resolve(true)
763
+ limitlessIntervalCaptureBuilder = null
764
+ } catch (t: Throwable) {
765
+ promise.reject(t)
766
+ limitlessIntervalCaptureBuilder = null
767
+ }
768
+ }
769
+ }
770
+
771
+ /**
772
+ * startCapture - start capture limitless interval
773
+ * @param promise promise to set result
774
+ */
775
+ @ReactMethod
776
+ fun startLimitlessIntervalCapture(promise: Promise) {
777
+ if (theta == null) {
778
+ promise.reject(Exception(messageNotInit))
779
+ return
780
+ }
781
+ if (limitlessIntervalCapture == null) {
782
+ promise.reject(Exception("no limitlessIntervalCapture"))
783
+ return
784
+ }
785
+ class StartCaptureCallback : LimitlessIntervalCapture.StartCaptureCallback {
786
+ override fun onCaptureCompleted(fileUrls: List<String>?) {
787
+ promise.resolve(fileUrls?.let {
788
+ val resultList = Arguments.createArray()
789
+ it.forEach {
790
+ resultList.pushString(it)
791
+ }
792
+ resultList
793
+ })
794
+ limitlessIntervalCapture = null
795
+ limitlessIntervalCapturing = null
796
+ }
797
+
798
+ override fun onCaptureFailed(exception: ThetaRepository.ThetaRepositoryException) {
799
+ promise.reject(exception)
800
+ limitlessIntervalCapture = null
801
+ limitlessIntervalCapturing = null
802
+ }
803
+
804
+ override fun onStopFailed(exception: ThetaRepository.ThetaRepositoryException) {
805
+ sendNotifyEvent(
806
+ toNotify(
807
+ NOTIFY_LIMITLESS_INTERVAL_CAPTURE_STOP_ERROR,
808
+ toMessageNotifyParam(exception.message ?: exception.toString())
809
+ )
810
+ )
811
+ }
812
+ }
813
+ limitlessIntervalCapturing = limitlessIntervalCapture?.startCapture(StartCaptureCallback())
814
+ }
815
+
816
+ /**
817
+ * stopCapture - stop capturing limitless interval
818
+ */
819
+ @ReactMethod
820
+ fun stopLimitlessIntervalCapture() {
821
+ if (theta == null) {
822
+ throw Exception(messageNotInit)
823
+ }
824
+ limitlessIntervalCapturing?.stopCapture()
825
+ }
826
+
827
+ /**
828
+ * getShotCountSpecifiedIntervalCaptureBuilder - get interval shooting with the shot count specified builder from repository
829
+ * @param shotCount shotCount shot count specified
830
+ * @param promise Promise for getShotCountSpecifiedIntervalCaptureBuilder
831
+ */
832
+ @ReactMethod
833
+ fun getShotCountSpecifiedIntervalCaptureBuilder(shotCount: Int, promise: Promise) {
834
+ val theta = theta
835
+ if (theta == null) {
836
+ promise.reject(Exception(messageNotInit))
837
+ return
838
+ }
839
+ shotCountSpecifiedIntervalCaptureBuilder = theta.getShotCountSpecifiedIntervalCaptureBuilder(shotCount)
840
+ promise.resolve(true)
841
+ }
842
+
843
+ /**
844
+ * buildShotCountSpecifiedIntervalCapture - build interval shooting with the shot count specified
845
+ * @param options option to execute interval shooting with the shot count specified
846
+ * @param promise Promise for buildShotCountSpecifiedIntervalCapture
847
+ */
848
+ @ReactMethod
849
+ fun buildShotCountSpecifiedIntervalCapture(options: ReadableMap, promise: Promise) {
850
+ if (theta == null) {
851
+ promise.reject(Exception(messageNotInit))
852
+ return
853
+ }
854
+ if (shotCountSpecifiedIntervalCaptureBuilder == null) {
855
+ promise.reject(Exception("no shotCountSpecifiedIntervalCaptureBuilder"))
856
+ return
857
+ }
858
+ launch {
859
+ try {
860
+ shotCountSpecifiedIntervalCaptureBuilder?.let {
861
+ setCaptureBuilderParams(optionMap = options, builder = it)
862
+ setShotCountSpecifiedIntervalCaptureBuilderParams(optionMap = options, builder = it)
863
+ shotCountSpecifiedIntervalCapture = it.build()
864
+ }
865
+ promise.resolve(true)
866
+ shotCountSpecifiedIntervalCaptureBuilder = null
867
+ } catch (t: Throwable) {
868
+ promise.reject(t)
869
+ shotCountSpecifiedIntervalCaptureBuilder = null
870
+ }
871
+ }
872
+ }
873
+
874
+ /**
875
+ * startShotCountSpecifiedIntervalCapture - start interval shooting with the shot count specified
876
+ * @param promise promise for startShotCountSpecifiedIntervalCapture
877
+ */
878
+ @ReactMethod
879
+ fun startShotCountSpecifiedIntervalCapture(promise: Promise) {
880
+ if (theta == null) {
881
+ promise.reject(Exception(messageNotInit))
882
+ return
883
+ }
884
+ if (shotCountSpecifiedIntervalCapture == null) {
885
+ promise.reject(Exception("no shotCountSpecifiedIntervalCapture"))
886
+ return
887
+ }
888
+ class StartCaptureCallback : ShotCountSpecifiedIntervalCapture.StartCaptureCallback {
889
+ override fun onCaptureCompleted(fileUrls: List<String>?) {
890
+ promise.resolve(fileUrls?.let {
891
+ val resultList = Arguments.createArray()
892
+ it.forEach {
893
+ resultList.pushString(it)
894
+ }
895
+ resultList
896
+ })
897
+ shotCountSpecifiedIntervalCapture = null
898
+ }
899
+
900
+ override fun onProgress(completion: Float) {
901
+ sendNotifyEvent(
902
+ toNotify(
903
+ NOTIFY_SHOT_COUNT_SPECIFIED_INTERVAL_PROGRESS,
904
+ toCaptureProgressNotifyParam(value = completion)
905
+ )
906
+ )
907
+ }
908
+
909
+ override fun onStopFailed(exception: ThetaRepository.ThetaRepositoryException) {
910
+ sendNotifyEvent(
911
+ toNotify(
912
+ NOTIFY_SHOT_COUNT_SPECIFIED_INTERVAL_STOP_ERROR,
913
+ toMessageNotifyParam(exception.message ?: exception.toString())
914
+ )
915
+ )
916
+ }
917
+
918
+ override fun onCaptureFailed(exception: ThetaRepository.ThetaRepositoryException) {
919
+ promise.reject(exception)
920
+ shotCountSpecifiedIntervalCapture = null
921
+ }
922
+ }
923
+ shotCountSpecifiedIntervalCapturing =
924
+ shotCountSpecifiedIntervalCapture?.startCapture(StartCaptureCallback())
925
+ }
926
+
927
+ /**
928
+ * cancelShotCountSpecifiedIntervalCapture - stop interval shooting with the shot count specified
929
+ * @param promise promise for cancelShotCountSpecifiedIntervalCapture
930
+ */
931
+ @ReactMethod
932
+ fun cancelShotCountSpecifiedIntervalCapture(promise: Promise) {
933
+ if (theta == null) {
934
+ promise.reject(Exception(messageNotInit))
935
+ return
936
+ }
937
+ shotCountSpecifiedIntervalCapturing?.cancelCapture()
938
+ promise.resolve(true)
939
+ }
940
+
852
941
  /**
853
942
  * getMetadata - retrieve meta data from THETA via repository
854
943
  * @param promise promise to set result
@@ -1036,29 +1125,8 @@ class ThetaClientReactNativeModule(
1036
1125
  }
1037
1126
  launch {
1038
1127
  try {
1039
- val result = Arguments.createArray()
1040
- theta.listAccessPoints().forEach {
1041
- val apinfo = Arguments.createMap()
1042
- apinfo.putString("ssid", it.ssid)
1043
- apinfo.putBoolean("ssidStealth", it.ssidStealth)
1044
- apinfo.putString("authMode", it.authMode.toString())
1045
- apinfo.putInt("connectionPriority", it.connectionPriority)
1046
- apinfo.putBoolean("usingDhcp", it.usingDhcp)
1047
- apinfo.putString("ipAddress", it.ipAddress)
1048
- apinfo.putString("subnetMask", it.subnetMask)
1049
- apinfo.putString("defaultGateway", it.defaultGateway)
1050
-
1051
- it.proxy?.let { proxy ->
1052
- var options = ThetaRepository.Options(proxy = proxy)
1053
- val optionsMap = Arguments.createMap()
1054
- val cvt = converters["proxy"]
1055
- cvt?.setFromTheta(options, optionsMap)
1056
- apinfo.putMap("proxy", optionsMap.getMap("proxy"))
1057
- }
1058
-
1059
- result.pushMap(apinfo)
1060
- }
1061
- promise.resolve(result)
1128
+ val response = theta.listAccessPoints()
1129
+ promise.resolve(toListAccessPointsResult(accessPointList = response))
1062
1130
  } catch (t: Throwable) {
1063
1131
  promise.reject(t)
1064
1132
  }
@@ -1098,7 +1166,7 @@ class ThetaClientReactNativeModule(
1098
1166
  ThetaRepository.AuthModeEnum.valueOf(authMode),
1099
1167
  password,
1100
1168
  connectionPriority,
1101
- convertMapToProxy(proxyMap = proxy)
1169
+ toProxy(map = proxy)
1102
1170
  )
1103
1171
  promise.resolve(true)
1104
1172
  } catch (t: Throwable) {
@@ -1149,7 +1217,7 @@ class ThetaClientReactNativeModule(
1149
1217
  ipAddress,
1150
1218
  subnetMask,
1151
1219
  defaultGateway,
1152
- convertMapToProxy(proxyMap = proxy)
1220
+ toProxy(map = proxy)
1153
1221
  )
1154
1222
  promise.resolve(true)
1155
1223
  } catch (t: Throwable) {
@@ -1180,20 +1248,6 @@ class ThetaClientReactNativeModule(
1180
1248
  }
1181
1249
  }
1182
1250
 
1183
- /**
1184
- * convert ReadableMap to ThetaRepository.Proxy
1185
- */
1186
- private fun convertMapToProxy(proxyMap: ReadableMap?): ThetaRepository.Proxy? {
1187
- return proxyMap?.let {
1188
- var options = ThetaRepository.Options()
1189
- val optionsMap = Arguments.createMap()
1190
- optionsMap.putMap("proxy", it)
1191
- val cvt = converters["proxy"]
1192
- cvt?.setToTheta(options, optionsMap)
1193
- options.proxy
1194
- } ?: null
1195
- }
1196
-
1197
1251
  /**
1198
1252
  * setBluetoothDevice - register uuid of a BLE device
1199
1253
  * @param uuid uuid to set
@@ -1232,12 +1286,7 @@ class ThetaClientReactNativeModule(
1232
1286
  launch {
1233
1287
  try {
1234
1288
  val options = theta.getMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
1235
- val result = Arguments.createMap()
1236
- converters.forEach {
1237
- val cvt = it.value
1238
- cvt?.setFromTheta(options, result)
1239
- }
1240
- promise.resolve(result)
1289
+ promise.resolve(toResult(options = options))
1241
1290
  } catch (t: Throwable) {
1242
1291
  promise.reject(t)
1243
1292
  }
@@ -1265,13 +1314,7 @@ class ThetaClientReactNativeModule(
1265
1314
  optionNameList.add(ThetaRepository.OptionNameEnum.valueOf(option))
1266
1315
  }
1267
1316
  val options = theta.getMySetting(optionNameList)
1268
- val result = Arguments.createMap()
1269
- for (index in 0..(optionNames.size() - 1)) {
1270
- val option = optionEnumToOption[optionNames.getString(index)]
1271
- val cvt = converters[option]
1272
- cvt?.setFromTheta(options, result)
1273
- }
1274
- promise.resolve(result)
1317
+ promise.resolve(toResult(options = options))
1275
1318
  } catch (t: Throwable) {
1276
1319
  promise.reject(t)
1277
1320
  }
@@ -1293,13 +1336,7 @@ class ThetaClientReactNativeModule(
1293
1336
  }
1294
1337
  launch {
1295
1338
  try {
1296
- val thetaOptions = ThetaRepository.Options()
1297
- val iterator = options.keySetIterator()
1298
- while (iterator.hasNextKey()) {
1299
- val key = iterator.nextKey()
1300
- val cvt = converters[key]
1301
- cvt?.setToTheta(thetaOptions, options)
1302
- }
1339
+ val thetaOptions = toSetOptionsParam(optionsMap = options)
1303
1340
  theta.setMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode), thetaOptions)
1304
1341
  promise.resolve(true)
1305
1342
  } catch (t: Throwable) {
@@ -1510,5 +1547,8 @@ class ThetaClientReactNativeModule(
1510
1547
  const val EVENT_NOTIFY = "ThetaNotify"
1511
1548
  const val NOTIFY_TIMESHIFT_PROGRESS = "TIME-SHIFT-PROGRESS"
1512
1549
  const val NOTIFY_VIDEO_CAPTURE_STOP_ERROR = "VIDEO-CAPTURE-STOP-ERROR"
1550
+ const val NOTIFY_LIMITLESS_INTERVAL_CAPTURE_STOP_ERROR = "LIMITLESS-INTERVAL-CAPTURE-STOP-ERROR"
1551
+ const val NOTIFY_SHOT_COUNT_SPECIFIED_INTERVAL_PROGRESS = "SHOT-COUNT-SPECIFIED-INTERVAL-PROGRESS"
1552
+ const val NOTIFY_SHOT_COUNT_SPECIFIED_INTERVAL_STOP_ERROR = "SHOT-COUNT-SPECIFIED-INTERVAL-STOP-ERROR"
1513
1553
  }
1514
1554
  }