theta-client-react-native 1.7.1 → 1.9.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 (197) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +164 -9
  3. package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +76 -38
  4. package/ios/ConvertUtil.swift +157 -26
  5. package/ios/ThetaClientReactNative.m +9 -0
  6. package/ios/ThetaClientReactNative.swift +113 -23
  7. package/lib/commonjs/capture/burst-capture.js.map +1 -1
  8. package/lib/commonjs/capture/capture.js.map +1 -1
  9. package/lib/commonjs/capture/composite-interval-capture.js.map +1 -1
  10. package/lib/commonjs/capture/continuous-capture.js.map +1 -1
  11. package/lib/commonjs/capture/index.js.map +1 -1
  12. package/lib/commonjs/capture/limitless-interval-capture.js.map +1 -1
  13. package/lib/commonjs/capture/multi-bracket-capture.js.map +1 -1
  14. package/lib/commonjs/capture/photo-capture.js.map +1 -1
  15. package/lib/commonjs/capture/shot-count-specified-interval-capture.js.map +1 -1
  16. package/lib/commonjs/capture/time-shift-capture.js.map +1 -1
  17. package/lib/commonjs/capture/video-capture.js.map +1 -1
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/theta-repository/access-point.js.map +1 -1
  20. package/lib/commonjs/theta-repository/digest-auth.js.map +1 -1
  21. package/lib/commonjs/theta-repository/event-websocket.js +39 -0
  22. package/lib/commonjs/theta-repository/event-websocket.js.map +1 -0
  23. package/lib/commonjs/theta-repository/index.js +11 -0
  24. package/lib/commonjs/theta-repository/index.js.map +1 -1
  25. package/lib/commonjs/theta-repository/notify-controller.js.map +1 -1
  26. package/lib/commonjs/theta-repository/options/index.js +33 -0
  27. package/lib/commonjs/theta-repository/options/index.js.map +1 -1
  28. package/lib/commonjs/theta-repository/options/option-ai-auto-thumbnail.js.map +1 -1
  29. package/lib/commonjs/theta-repository/options/option-auto-bracket.js.map +1 -1
  30. package/lib/commonjs/theta-repository/options/option-bitrate.js.map +1 -1
  31. package/lib/commonjs/theta-repository/options/option-bluetooth-role.js.map +1 -1
  32. package/lib/commonjs/theta-repository/options/option-burst-mode.js.map +1 -1
  33. package/lib/commonjs/theta-repository/options/option-burst-option.js.map +1 -1
  34. package/lib/commonjs/theta-repository/options/option-camera-control-source.js.map +1 -1
  35. package/lib/commonjs/theta-repository/options/option-camera-mode.js.map +1 -1
  36. package/lib/commonjs/theta-repository/options/option-capture-mode.js.map +1 -1
  37. package/lib/commonjs/theta-repository/options/option-continuous-number.js.map +1 -1
  38. package/lib/commonjs/theta-repository/options/option-ethernet-config.js +6 -0
  39. package/lib/commonjs/theta-repository/options/option-ethernet-config.js.map +1 -0
  40. package/lib/commonjs/theta-repository/options/option-face-detect.js.map +1 -1
  41. package/lib/commonjs/theta-repository/options/option-file-format.js +89 -0
  42. package/lib/commonjs/theta-repository/options/option-file-format.js.map +1 -0
  43. package/lib/commonjs/theta-repository/options/option-filter.js +3 -2
  44. package/lib/commonjs/theta-repository/options/option-filter.js.map +1 -1
  45. package/lib/commonjs/theta-repository/options/option-function.js.map +1 -1
  46. package/lib/commonjs/theta-repository/options/option-gain.js.map +1 -1
  47. package/lib/commonjs/theta-repository/options/option-image-stitching.js.map +1 -1
  48. package/lib/commonjs/theta-repository/options/option-max-recordable-time.js +28 -0
  49. package/lib/commonjs/theta-repository/options/option-max-recordable-time.js.map +1 -0
  50. package/lib/commonjs/theta-repository/options/option-network-type.js.map +1 -1
  51. package/lib/commonjs/theta-repository/options/option-off-delay.js.map +1 -1
  52. package/lib/commonjs/theta-repository/options/option-power-saving.js.map +1 -1
  53. package/lib/commonjs/theta-repository/options/option-preset.js.map +1 -1
  54. package/lib/commonjs/theta-repository/options/option-preview-format.js.map +1 -1
  55. package/lib/commonjs/theta-repository/options/option-proxy.js.map +1 -1
  56. package/lib/commonjs/theta-repository/options/option-shooting-method.js.map +1 -1
  57. package/lib/commonjs/theta-repository/options/option-shutter-speed.js.map +1 -1
  58. package/lib/commonjs/theta-repository/options/option-sleep-delay.js.map +1 -1
  59. package/lib/commonjs/theta-repository/options/option-time-shift.js.map +1 -1
  60. package/lib/commonjs/theta-repository/options/option-top-bottom-correction-rotation.js.map +1 -1
  61. package/lib/commonjs/theta-repository/options/option-top-bottom-correction.js.map +1 -1
  62. package/lib/commonjs/theta-repository/options/option-video-stitching.js.map +1 -1
  63. package/lib/commonjs/theta-repository/options/option-visibility-reduction.js.map +1 -1
  64. package/lib/commonjs/theta-repository/options/option-white-balance-auto-strength.js.map +1 -1
  65. package/lib/commonjs/theta-repository/options/option-wlan-frequency.js.map +1 -1
  66. package/lib/commonjs/theta-repository/options/options.js +3 -81
  67. package/lib/commonjs/theta-repository/options/options.js.map +1 -1
  68. package/lib/commonjs/theta-repository/theta-config.js.map +1 -1
  69. package/lib/commonjs/theta-repository/theta-files.js.map +1 -1
  70. package/lib/commonjs/theta-repository/theta-info.js.map +1 -1
  71. package/lib/commonjs/theta-repository/theta-meta.js.map +1 -1
  72. package/lib/commonjs/theta-repository/theta-plugin.js.map +1 -1
  73. package/lib/commonjs/theta-repository/theta-repository.js +11 -0
  74. package/lib/commonjs/theta-repository/theta-repository.js.map +1 -1
  75. package/lib/commonjs/theta-repository/theta-state/camera-error.js.map +1 -1
  76. package/lib/commonjs/theta-repository/theta-state/index.js +11 -0
  77. package/lib/commonjs/theta-repository/theta-state/index.js.map +1 -1
  78. package/lib/commonjs/theta-repository/theta-state/state-gps-info.js +6 -0
  79. package/lib/commonjs/theta-repository/theta-state/state-gps-info.js.map +1 -0
  80. package/lib/commonjs/theta-repository/theta-state/theta-state.js.map +1 -1
  81. package/lib/commonjs/theta-repository/theta-timeout.js.map +1 -1
  82. package/lib/module/capture/burst-capture.js.map +1 -1
  83. package/lib/module/capture/capture.js.map +1 -1
  84. package/lib/module/capture/composite-interval-capture.js.map +1 -1
  85. package/lib/module/capture/continuous-capture.js.map +1 -1
  86. package/lib/module/capture/index.js.map +1 -1
  87. package/lib/module/capture/limitless-interval-capture.js.map +1 -1
  88. package/lib/module/capture/multi-bracket-capture.js.map +1 -1
  89. package/lib/module/capture/photo-capture.js.map +1 -1
  90. package/lib/module/capture/shot-count-specified-interval-capture.js.map +1 -1
  91. package/lib/module/capture/time-shift-capture.js.map +1 -1
  92. package/lib/module/capture/video-capture.js.map +1 -1
  93. package/lib/module/index.js.map +1 -1
  94. package/lib/module/theta-repository/access-point.js.map +1 -1
  95. package/lib/module/theta-repository/digest-auth.js.map +1 -1
  96. package/lib/module/theta-repository/event-websocket.js +32 -0
  97. package/lib/module/theta-repository/event-websocket.js.map +1 -0
  98. package/lib/module/theta-repository/index.js +1 -0
  99. package/lib/module/theta-repository/index.js.map +1 -1
  100. package/lib/module/theta-repository/notify-controller.js.map +1 -1
  101. package/lib/module/theta-repository/options/index.js +3 -0
  102. package/lib/module/theta-repository/options/index.js.map +1 -1
  103. package/lib/module/theta-repository/options/option-ai-auto-thumbnail.js.map +1 -1
  104. package/lib/module/theta-repository/options/option-auto-bracket.js.map +1 -1
  105. package/lib/module/theta-repository/options/option-bitrate.js.map +1 -1
  106. package/lib/module/theta-repository/options/option-bluetooth-role.js.map +1 -1
  107. package/lib/module/theta-repository/options/option-burst-mode.js.map +1 -1
  108. package/lib/module/theta-repository/options/option-burst-option.js.map +1 -1
  109. package/lib/module/theta-repository/options/option-camera-control-source.js.map +1 -1
  110. package/lib/module/theta-repository/options/option-camera-mode.js.map +1 -1
  111. package/lib/module/theta-repository/options/option-capture-mode.js.map +1 -1
  112. package/lib/module/theta-repository/options/option-continuous-number.js.map +1 -1
  113. package/lib/module/theta-repository/options/option-ethernet-config.js +2 -0
  114. package/lib/module/theta-repository/options/option-ethernet-config.js.map +1 -0
  115. package/lib/module/theta-repository/options/option-face-detect.js.map +1 -1
  116. package/lib/module/theta-repository/options/option-file-format.js +83 -0
  117. package/lib/module/theta-repository/options/option-file-format.js.map +1 -0
  118. package/lib/module/theta-repository/options/option-filter.js +3 -2
  119. package/lib/module/theta-repository/options/option-filter.js.map +1 -1
  120. package/lib/module/theta-repository/options/option-function.js.map +1 -1
  121. package/lib/module/theta-repository/options/option-gain.js.map +1 -1
  122. package/lib/module/theta-repository/options/option-image-stitching.js.map +1 -1
  123. package/lib/module/theta-repository/options/option-max-recordable-time.js +22 -0
  124. package/lib/module/theta-repository/options/option-max-recordable-time.js.map +1 -0
  125. package/lib/module/theta-repository/options/option-network-type.js.map +1 -1
  126. package/lib/module/theta-repository/options/option-off-delay.js.map +1 -1
  127. package/lib/module/theta-repository/options/option-power-saving.js.map +1 -1
  128. package/lib/module/theta-repository/options/option-preset.js.map +1 -1
  129. package/lib/module/theta-repository/options/option-preview-format.js.map +1 -1
  130. package/lib/module/theta-repository/options/option-proxy.js.map +1 -1
  131. package/lib/module/theta-repository/options/option-shooting-method.js.map +1 -1
  132. package/lib/module/theta-repository/options/option-shutter-speed.js.map +1 -1
  133. package/lib/module/theta-repository/options/option-sleep-delay.js.map +1 -1
  134. package/lib/module/theta-repository/options/option-time-shift.js.map +1 -1
  135. package/lib/module/theta-repository/options/option-top-bottom-correction-rotation.js.map +1 -1
  136. package/lib/module/theta-repository/options/option-top-bottom-correction.js.map +1 -1
  137. package/lib/module/theta-repository/options/option-video-stitching.js.map +1 -1
  138. package/lib/module/theta-repository/options/option-visibility-reduction.js.map +1 -1
  139. package/lib/module/theta-repository/options/option-white-balance-auto-strength.js.map +1 -1
  140. package/lib/module/theta-repository/options/option-wlan-frequency.js.map +1 -1
  141. package/lib/module/theta-repository/options/options.js +2 -80
  142. package/lib/module/theta-repository/options/options.js.map +1 -1
  143. package/lib/module/theta-repository/theta-config.js.map +1 -1
  144. package/lib/module/theta-repository/theta-files.js.map +1 -1
  145. package/lib/module/theta-repository/theta-info.js.map +1 -1
  146. package/lib/module/theta-repository/theta-meta.js.map +1 -1
  147. package/lib/module/theta-repository/theta-plugin.js.map +1 -1
  148. package/lib/module/theta-repository/theta-repository.js +10 -0
  149. package/lib/module/theta-repository/theta-repository.js.map +1 -1
  150. package/lib/module/theta-repository/theta-state/camera-error.js.map +1 -1
  151. package/lib/module/theta-repository/theta-state/index.js +1 -0
  152. package/lib/module/theta-repository/theta-state/index.js.map +1 -1
  153. package/lib/module/theta-repository/theta-state/state-gps-info.js +2 -0
  154. package/lib/module/theta-repository/theta-state/state-gps-info.js.map +1 -0
  155. package/lib/module/theta-repository/theta-state/theta-state.js.map +1 -1
  156. package/lib/module/theta-repository/theta-timeout.js.map +1 -1
  157. package/lib/typescript/theta-repository/event-websocket.d.ts +14 -0
  158. package/lib/typescript/theta-repository/event-websocket.d.ts.map +1 -0
  159. package/lib/typescript/theta-repository/index.d.ts +1 -0
  160. package/lib/typescript/theta-repository/index.d.ts.map +1 -1
  161. package/lib/typescript/theta-repository/options/index.d.ts +3 -0
  162. package/lib/typescript/theta-repository/options/index.d.ts.map +1 -1
  163. package/lib/typescript/theta-repository/options/option-ethernet-config.d.ts +29 -0
  164. package/lib/typescript/theta-repository/options/option-ethernet-config.d.ts.map +1 -0
  165. package/lib/typescript/theta-repository/options/option-file-format.d.ts +102 -0
  166. package/lib/typescript/theta-repository/options/option-file-format.d.ts.map +1 -0
  167. package/lib/typescript/theta-repository/options/option-filter.d.ts +3 -2
  168. package/lib/typescript/theta-repository/options/option-filter.d.ts.map +1 -1
  169. package/lib/typescript/theta-repository/options/option-max-recordable-time.d.ts +22 -0
  170. package/lib/typescript/theta-repository/options/option-max-recordable-time.d.ts.map +1 -0
  171. package/lib/typescript/theta-repository/options/options.d.ts +8 -77
  172. package/lib/typescript/theta-repository/options/options.d.ts.map +1 -1
  173. package/lib/typescript/theta-repository/theta-files.d.ts +1 -1
  174. package/lib/typescript/theta-repository/theta-files.d.ts.map +1 -1
  175. package/lib/typescript/theta-repository/theta-repository.d.ts +2 -0
  176. package/lib/typescript/theta-repository/theta-repository.d.ts.map +1 -1
  177. package/lib/typescript/theta-repository/theta-state/index.d.ts +1 -0
  178. package/lib/typescript/theta-repository/theta-state/index.d.ts.map +1 -1
  179. package/lib/typescript/theta-repository/theta-state/state-gps-info.d.ts +9 -0
  180. package/lib/typescript/theta-repository/theta-state/state-gps-info.d.ts.map +1 -0
  181. package/lib/typescript/theta-repository/theta-state/theta-state.d.ts +29 -20
  182. package/lib/typescript/theta-repository/theta-state/theta-state.d.ts.map +1 -1
  183. package/package.json +1 -1
  184. package/src/theta-repository/event-websocket.ts +52 -0
  185. package/src/theta-repository/index.ts +1 -0
  186. package/src/theta-repository/options/index.ts +3 -0
  187. package/src/theta-repository/options/option-ethernet-config.ts +29 -0
  188. package/src/theta-repository/options/option-file-format.ts +90 -0
  189. package/src/theta-repository/options/option-filter.ts +3 -2
  190. package/src/theta-repository/options/option-max-recordable-time.ts +23 -0
  191. package/src/theta-repository/options/options.ts +8 -89
  192. package/src/theta-repository/theta-files.ts +1 -1
  193. package/src/theta-repository/theta-repository.ts +13 -0
  194. package/src/theta-repository/theta-state/index.ts +1 -0
  195. package/src/theta-repository/theta-state/state-gps-info.ts +9 -0
  196. package/src/theta-repository/theta-state/theta-state.ts +29 -20
  197. package/theta-client-react-native.podspec +1 -1
@@ -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.7.1"
137
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
138
+ implementation "com.ricoh360.thetaclient:theta-client:1.9.0"
139
139
 
140
140
  // From node_modules
141
141
  }
@@ -9,11 +9,18 @@ import com.facebook.react.bridge.WritableArray
9
9
  import com.ricoh360.thetaclient.DigestAuth
10
10
  import com.ricoh360.thetaclient.ThetaRepository.*
11
11
  import com.ricoh360.thetaclient.capture.*
12
+ import com.ricoh360.thetaclient.websocket.CameraEvent
12
13
 
13
14
  const val KEY_NOTIFY_NAME = "name"
14
15
  const val KEY_NOTIFY_PARAMS = "params"
15
16
  const val KEY_NOTIFY_PARAM_COMPLETION = "completion"
17
+ const val KEY_NOTIFY_PARAM_EVENT = "event"
16
18
  const val KEY_NOTIFY_PARAM_MESSAGE = "message"
19
+ const val KEY_GPS_INFO = "gpsInfo"
20
+ const val KEY_STATE_EXTERNAL_GPS_INFO = "externalGpsInfo"
21
+ const val KEY_STATE_INTERNAL_GPS_INFO = "internalGpsInfo"
22
+ const val KEY_STATE_BOARD_TEMP = "boardTemp"
23
+ const val KEY_STATE_BATTERY_TEMP = "batteryTemp"
17
24
 
18
25
  val optionItemNameToEnum: Map<String, OptionNameEnum> = mutableMapOf(
19
26
  "aiAutoThumbnail" to OptionNameEnum.AiAutoThumbnail,
@@ -34,6 +41,7 @@ val optionItemNameToEnum: Map<String, OptionNameEnum> = mutableMapOf(
34
41
  "compositeShootingTime" to OptionNameEnum.CompositeShootingTime,
35
42
  "continuousNumber" to OptionNameEnum.ContinuousNumber,
36
43
  "dateTimeZone" to OptionNameEnum.DateTimeZone,
44
+ "ethernetConfig" to OptionNameEnum.EthernetConfig,
37
45
  "exposureCompensation" to OptionNameEnum.ExposureCompensation,
38
46
  "exposureDelay" to OptionNameEnum.ExposureDelay,
39
47
  "exposureProgram" to OptionNameEnum.ExposureProgram,
@@ -94,6 +102,12 @@ fun toCaptureProgressNotifyParam(value: Float): WritableMap {
94
102
  return result
95
103
  }
96
104
 
105
+ fun toEventWebSocketEventNotifyParam(value: CameraEvent): WritableMap {
106
+ val result = Arguments.createMap()
107
+ result.putMap(KEY_NOTIFY_PARAM_EVENT, toResult(value))
108
+ return result
109
+ }
110
+
97
111
  fun toMessageNotifyParam(value: String): WritableMap {
98
112
  val result = Arguments.createMap()
99
113
  result.putString(KEY_NOTIFY_PARAM_MESSAGE, value)
@@ -300,6 +314,10 @@ fun toResult(options: Options): WritableMap {
300
314
  options.burstOption?.let {
301
315
  result.putMap("burstOption", toResult(burstOption = it))
302
316
  }
317
+ } else if (name == OptionNameEnum.EthernetConfig) {
318
+ options.ethernetConfig?.let {
319
+ result.putMap("ethernetConfig", toResult(ethernetConfig = it))
320
+ }
303
321
  } else if (name == OptionNameEnum.GpsInfo) {
304
322
  options.gpsInfo?.let {
305
323
  result.putMap("gpsInfo", toResult(gpsInfo = it))
@@ -346,16 +364,23 @@ fun <T : Enum<T>> addOptionsEnumToMap(options: Options, name: OptionNameEnum, ob
346
364
  }
347
365
 
348
366
  fun <T> addOptionsValueToMap(options: Options, name: OptionNameEnum, objects: WritableMap) {
349
- val key = optionNameEnumToItemName[name]
350
- if (key == null) return
367
+ val key = optionNameEnumToItemName[name] ?: return
351
368
  options.getValue<T>(name)?.let { value ->
352
- if (value is Int) {
353
- objects.putInt(key, value)
354
- } else {
355
- (value as? String)?.toDouble()?.let {
356
- objects.putDouble(key, it)
357
- } ?: run {
358
- objects.putString(key, (value as String))
369
+ when (value) {
370
+ is String -> {
371
+ objects.putString(key, value)
372
+ }
373
+
374
+ is Int -> {
375
+ objects.putInt(key, value)
376
+ }
377
+
378
+ is Number -> {
379
+ objects.putDouble(key, value.toDouble())
380
+ }
381
+
382
+ else -> {
383
+ objects.putString(key, value.toString())
359
384
  }
360
385
  }
361
386
  }
@@ -480,6 +505,24 @@ fun toResult(fileInfo: FileInfo): ReadableMap {
480
505
  return result
481
506
  }
482
507
 
508
+ fun toResult(ethernetConfig: EthernetConfig): WritableMap {
509
+ val result = Arguments.createMap()
510
+ result.putBoolean("usingDhcp", ethernetConfig.usingDhcp)
511
+ ethernetConfig.ipAddress?.let { ipAddress ->
512
+ result.putString("ipAddress", ipAddress)
513
+ }
514
+ ethernetConfig.subnetMask?.let { subnetMask ->
515
+ result.putString("subnetMask", subnetMask)
516
+ }
517
+ ethernetConfig.defaultGateway?.let { defaultGateway ->
518
+ result.putString("defaultGateway", defaultGateway)
519
+ }
520
+ ethernetConfig.proxy?.let { proxy ->
521
+ result.putMap("proxy", toResult(proxy = proxy))
522
+ }
523
+ return result
524
+ }
525
+
483
526
  fun toResult(gpsInfo: GpsInfo): WritableMap {
484
527
  val result = Arguments.createMap()
485
528
  result.putDouble("latitude", gpsInfo.latitude.toDouble())
@@ -489,6 +532,14 @@ fun toResult(gpsInfo: GpsInfo): WritableMap {
489
532
  return result
490
533
  }
491
534
 
535
+ fun toResult(stateGpsInfo: StateGpsInfo): WritableMap {
536
+ val result = Arguments.createMap()
537
+ stateGpsInfo.gpsInfo?.let {
538
+ result.putMap(KEY_GPS_INFO, toResult(it))
539
+ }
540
+ return result
541
+ }
542
+
492
543
  fun toResult(proxy: Proxy): WritableMap {
493
544
  val result = Arguments.createMap()
494
545
  result.putBoolean("use", proxy.use)
@@ -521,6 +572,94 @@ fun toResult(timeShift: TimeShiftSetting): WritableMap {
521
572
  return result
522
573
  }
523
574
 
575
+ fun toResult(state: ThetaState): WritableMap {
576
+ val result = Arguments.createMap()
577
+ state.fingerprint?.let {
578
+ result.putString("fingerprint", it)
579
+ }
580
+ state.batteryLevel?.let {
581
+ result.putDouble("batteryLevel", it.toDouble())
582
+ }
583
+ state.storageUri?.let {
584
+ result.putString("storageUri", it)
585
+ }
586
+ state.storageID?.let {
587
+ result.putString("storageID", it)
588
+ }
589
+ state.captureStatus?.let {
590
+ result.putString("captureStatus", it.toString())
591
+ }
592
+ state.recordedTime?.let {
593
+ result.putInt("recordedTime", it)
594
+ }
595
+ state.recordableTime?.let {
596
+ result.putInt("recordableTime", it)
597
+ }
598
+ state.capturedPictures?.let {
599
+ result.putInt("capturedPictures", it)
600
+ }
601
+ state.compositeShootingElapsedTime?.let {
602
+ result.putString("compositeShootingElapsedTime", it.toString())
603
+ }
604
+ state.latestFileUrl?.let {
605
+ result.putString("latestFileUrl", it)
606
+ }
607
+ state.chargingState?.let {
608
+ result.putString("chargingState", it.toString())
609
+ }
610
+ state.apiVersion?.let {
611
+ result.putInt("apiVersion", it)
612
+ }
613
+ state.isPluginRunning?.let {
614
+ result.putBoolean("isPluginRunning", it)
615
+ }
616
+ state.isPluginWebServer?.let {
617
+ result.putBoolean("isPluginWebServer", it)
618
+ }
619
+ state.function?.let {
620
+ result.putString("function", it.toString())
621
+ }
622
+ state.isMySettingChanged?.let {
623
+ result.putBoolean("isMySettingChanged", it)
624
+ }
625
+ state.currentMicrophone?.let {
626
+ result.putString("currentMicrophone", it.toString())
627
+ }
628
+ state.isSdCard?.let {
629
+ result.putBoolean("isSdCard", it)
630
+ }
631
+ state.cameraError?.let { list ->
632
+ result.putArray("cameraError", Arguments.makeNativeArray(list.map { it.toString() }))
633
+ }
634
+ state.isBatteryInsert?.let {
635
+ result.putString("isBatteryInsert", it.toString())
636
+ }
637
+ state.externalGpsInfo?.let {
638
+ result.putMap(KEY_STATE_EXTERNAL_GPS_INFO, toResult(it))
639
+ }
640
+ state.internalGpsInfo?.let {
641
+ result.putMap(KEY_STATE_INTERNAL_GPS_INFO, toResult(it))
642
+ }
643
+ state.boardTemp?.let {
644
+ result.putInt(KEY_STATE_BOARD_TEMP, it)
645
+ }
646
+ state.batteryTemp?.let {
647
+ result.putInt(KEY_STATE_BATTERY_TEMP, it)
648
+ }
649
+ return result
650
+ }
651
+
652
+ fun toResult(cameraEvent: CameraEvent): WritableMap {
653
+ val result = Arguments.createMap()
654
+ cameraEvent.options?.let {
655
+ result.putMap("options", toResult(it))
656
+ }
657
+ cameraEvent.state?.let {
658
+ result.putMap("state", toResult(it))
659
+ }
660
+ return result
661
+ }
662
+
524
663
  fun toSetOptionsParam(optionsMap: ReadableMap): Options {
525
664
  val result = Options()
526
665
  val iterator = optionsMap.keySetIterator()
@@ -585,6 +724,10 @@ fun setOptionValue(options: Options, name: OptionNameEnum, optionsMap: ReadableM
585
724
  optionsMap.getMap(key)?.let {
586
725
  options.setValue(name, toBurstOption(map = it))
587
726
  }
727
+ } else if (name == OptionNameEnum.EthernetConfig) {
728
+ optionsMap.getMap(key)?.let {
729
+ options.setValue(name, toEthernetConfig(map = it) as Any)
730
+ }
588
731
  } else if (name == OptionNameEnum.GpsInfo) {
589
732
  optionsMap.getMap(key)?.let {
590
733
  options.setValue(name, toGpsInfo(map = it))
@@ -697,6 +840,18 @@ fun toAutoBracket(list: ReadableArray): BracketSettingList {
697
840
  return autoBracket
698
841
  }
699
842
 
843
+ fun toEthernetConfig(map: ReadableMap?): EthernetConfig? {
844
+ return map?.let {
845
+ EthernetConfig(
846
+ usingDhcp = if (it.hasKey("usingDhcp")) it.getBoolean("usingDhcp") else true,
847
+ ipAddress = if (it.hasKey("ipAddress")) it.getString("ipAddress") else null,
848
+ subnetMask = if (it.hasKey("subnetMask")) it.getString("subnetMask") else null,
849
+ defaultGateway = if (it.hasKey("defaultGateway")) it.getString("defaultGateway") else null,
850
+ proxy = if (it.hasKey("proxy")) toProxy(map = it.getMap("proxy")) else null
851
+ )
852
+ }
853
+ }
854
+
700
855
  fun toProxy(map: ReadableMap?): Proxy? {
701
856
  return map?.let {
702
857
  Proxy(
@@ -5,6 +5,8 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
5
5
  import com.ricoh360.thetaclient.ThetaRepository
6
6
  import com.ricoh360.thetaclient.ThetaRepository.*
7
7
  import com.ricoh360.thetaclient.capture.*
8
+ import com.ricoh360.thetaclient.websocket.CameraEvent
9
+ import com.ricoh360.thetaclient.websocket.EventWebSocket
8
10
  import kotlinx.coroutines.*
9
11
  import java.util.*
10
12
  import kotlin.coroutines.*
@@ -46,6 +48,7 @@ class ThetaClientReactNativeModule(
46
48
  var multiBracketCapturing: MultiBracketCapturing? = null
47
49
  var continuousCaptureBuilder: ContinuousCapture.Builder? = null
48
50
  var continuousCapture: ContinuousCapture? = null
51
+ var eventWebSocket: EventWebSocket? = null
49
52
  var theta: ThetaRepository? = null
50
53
  var listenerCount: Int = 0
51
54
 
@@ -78,7 +81,7 @@ class ThetaClientReactNativeModule(
78
81
  }
79
82
 
80
83
  /**
81
- * retreive constant
84
+ * retrieve constant
82
85
  */
83
86
  override fun getConstants(): MutableMap<String, Any> =
84
87
  hashMapOf("DEFAULT_EVENT_NAME" to EVENT_NAME)
@@ -119,6 +122,8 @@ class ThetaClientReactNativeModule(
119
122
  multiBracketCapturing = null
120
123
  continuousCaptureBuilder = null
121
124
  continuousCapture = null
125
+ eventWebSocket?.stop()
126
+ eventWebSocket = null
122
127
 
123
128
  theta = ThetaRepository.newInstance(
124
129
  endpoint,
@@ -214,43 +219,7 @@ class ThetaClientReactNativeModule(
214
219
  launch {
215
220
  try {
216
221
  val state = theta.getThetaState()
217
- val result = Arguments.createMap()
218
- result.putString("fingerprint", state.fingerprint)
219
- result.putDouble("batteryLevel", state.batteryLevel.toDouble())
220
- result.putString("storageUri", state.storageUri)
221
- result.putString("storageID", state.storageID)
222
- result.putString("captureStatus", state.captureStatus.toString())
223
- result.putInt("recordedTime", state.recordedTime)
224
- result.putInt("recordableTime", state.recordableTime)
225
- state.capturedPictures?.also {
226
- result.putInt("capturedPictures", state.capturedPictures!!)
227
- } ?: result.putNull("capturedPictures")
228
- state.compositeShootingElapsedTime?.also {
229
- result.putString("compositeShootingElapsedTime", state.compositeShootingElapsedTime.toString())
230
- } ?: result.putNull("compositeShootingElapsedTime")
231
- result.putString("latestFileUrl", state.latestFileUrl)
232
- result.putString("chargingState", state.chargingState.toString())
233
- result.putInt("apiVersion", state.apiVersion)
234
- state.isPluginRunning?.also {
235
- result.putBoolean("isPluginRunning", state.isPluginRunning!!)
236
- } ?: result.putNull("isPluginRunning")
237
- state.isPluginWebServer?.also {
238
- result.putBoolean("isPluginWebServer", state.isPluginWebServer!!)
239
- } ?: result.putNull("isPluginWebServer")
240
- state.function?.also {
241
- result.putString("function", state.function.toString())
242
- } ?: result.putNull("function")
243
- state.isMySettingChanged?.also {
244
- result.putBoolean("isMySettingChanged", state.isMySettingChanged!!)
245
- } ?: result.putNull("isMySettingChanged")
246
- result.putString("currentMicrophone", state.currentMicrophone?.toString())
247
- result.putBoolean("isSdCard", state.isSdCard)
248
- state.cameraError?.also {
249
- result.putArray("cameraError", Arguments.makeNativeArray(state.cameraError!!.map { it.toString() }))
250
- } ?: result.putNull("cameraError")
251
- state.isBatteryInsert?.also {
252
- result.putString("isBatteryInsert", state.isBatteryInsert.toString())
253
- } ?: result.putNull("isBatteryInsert")
222
+ val result = toResult(state)
254
223
  promise.resolve(result)
255
224
  } catch (t: Throwable) {
256
225
  promise.reject(t)
@@ -2023,6 +1992,73 @@ class ThetaClientReactNativeModule(
2023
1992
  }
2024
1993
  }
2025
1994
 
1995
+ @ReactMethod
1996
+ fun getEventWebSocket(promise: Promise) {
1997
+ val theta = this.theta
1998
+ if (theta == null) {
1999
+ promise.reject(Exception(messageNotInit))
2000
+ return
2001
+ }
2002
+ launch {
2003
+ eventWebSocket?.stop()
2004
+ eventWebSocket = theta.getEventWebSocket()
2005
+ promise.resolve(true)
2006
+ }
2007
+ }
2008
+
2009
+ @ReactMethod
2010
+ fun eventWebSocketStart(promise: Promise) {
2011
+ val theta = this.theta
2012
+ if (theta == null) {
2013
+ promise.reject(Exception(messageNotInit))
2014
+ return
2015
+ }
2016
+ val eventWebSocket = this.eventWebSocket
2017
+ if (eventWebSocket == null) {
2018
+ promise.reject(Exception("no eventWebSocket"))
2019
+ return
2020
+ }
2021
+ launch {
2022
+ eventWebSocket.stop()
2023
+ try {
2024
+ eventWebSocket.start(object : EventWebSocket.Callback {
2025
+ override fun onClose() {
2026
+ sendNotifyEvent(
2027
+ toNotify(NOTIFY_EVENT_WEBSOCKET_CLOSE, null)
2028
+ )
2029
+ }
2030
+
2031
+ override fun onReceive(event: CameraEvent) {
2032
+ sendNotifyEvent(
2033
+ toNotify(NOTIFY_EVENT_WEBSOCKET_EVENT, toEventWebSocketEventNotifyParam(event))
2034
+ )
2035
+ }
2036
+ })
2037
+ promise.resolve(true)
2038
+ } catch (t: Throwable) {
2039
+ promise.reject(t)
2040
+ }
2041
+ }
2042
+ }
2043
+
2044
+ @ReactMethod
2045
+ fun eventWebSocketStop(promise: Promise) {
2046
+ val theta = this.theta
2047
+ if (theta == null) {
2048
+ promise.reject(Exception(messageNotInit))
2049
+ return
2050
+ }
2051
+ val eventWebSocket = this.eventWebSocket
2052
+ if (eventWebSocket == null) {
2053
+ promise.reject(Exception("no eventWebSocket"))
2054
+ return
2055
+ }
2056
+ launch {
2057
+ eventWebSocket.stop()
2058
+ promise.resolve(true)
2059
+ }
2060
+ }
2061
+
2026
2062
  companion object {
2027
2063
  const val NAME = "ThetaClientReactNative"
2028
2064
  const val EVENT_NAME = "ThetaFrameEvent"
@@ -2040,5 +2076,7 @@ class ThetaClientReactNativeModule(
2040
2076
  const val NOTIFY_MULTI_BRACKET_PROGRESS = "MULTI-BRACKET-PROGRESS"
2041
2077
  const val NOTIFY_MULTI_BRACKET_STOP_ERROR = "MULTI-BRACKET-STOP-ERROR"
2042
2078
  const val NOTIFY_CONTINUOUS_PROGRESS = "CONTINUOUS-PROGRESS"
2079
+ const val NOTIFY_EVENT_WEBSOCKET_EVENT = "EVENT-WEBSOCKET-EVENT"
2080
+ const val NOTIFY_EVENT_WEBSOCKET_CLOSE = "EVENT-WEBSOCKET-CLOSE"
2043
2081
  }
2044
2082
  }
@@ -5,6 +5,7 @@ let KEY_CLIENT_MODE = "clientMode"
5
5
  let KEY_NOTIFY_NAME = "name"
6
6
  let KEY_NOTIFY_PARAMS = "params"
7
7
  let KEY_NOTIFY_PARAM_COMPLETION = "completion"
8
+ let KEY_NOTIFY_PARAM_EVENT = "event"
8
9
  let KEY_NOTIFY_PARAM_IMAGE = "image"
9
10
  let KEY_NOTIFY_PARAM_MESSAGE = "message"
10
11
  let KEY_DATETIME = "dateTime"
@@ -59,6 +60,16 @@ let KEY_TOP_BOTTOM_CORRECTION_ROTATION_ROLL = "roll"
59
60
  let KEY_TOP_BOTTOM_CORRECTION_ROTATION_YAW = "yaw"
60
61
  let KEY_TIMESHIFT_CAPTURE_INTERVAL = "_capture_interval"
61
62
  let KEY_AUTO_BRACKET = "autoBracket"
63
+ let KEY_STATE_EXTERNAL_GPS_INFO = "externalGpsInfo"
64
+ let KEY_STATE_INTERNAL_GPS_INFO = "internalGpsInfo"
65
+ let KEY_STATE_BOARD_TEMP = "boardTemp"
66
+ let KEY_STATE_BATTERY_TEMP = "batteryTemp"
67
+ let KEY_PROXY = "proxy"
68
+ let KEY_IP_ADDRESS = "ipAddress"
69
+ let KEY_SUBNET_MASK = "subnetMask"
70
+ let KEY_DEFAULT_GATEWAY = "defaultGateway"
71
+ let KEY_OPTIONS = "options"
72
+ let KEY_STATE = "state"
62
73
 
63
74
  public class ConvertUtil: NSObject {}
64
75
 
@@ -85,6 +96,7 @@ let optionItemNameToEnum = [
85
96
  "compositeShootingTime": ThetaRepository.OptionNameEnum.compositeshootingtime,
86
97
  "continuousNumber": ThetaRepository.OptionNameEnum.continuousnumber,
87
98
  "dateTimeZone": ThetaRepository.OptionNameEnum.datetimezone,
99
+ "ethernetConfig": ThetaRepository.OptionNameEnum.ethernetconfig,
88
100
  "exposureCompensation": ThetaRepository.OptionNameEnum.exposurecompensation,
89
101
  "exposureDelay": ThetaRepository.OptionNameEnum.exposuredelay,
90
102
  "exposureProgram": ThetaRepository.OptionNameEnum.exposureprogram,
@@ -221,6 +233,10 @@ func setOptionsValue(options: ThetaRepository.Options, name: String, value: Any)
221
233
  options.exposureCompensation = getEnumValue(
222
234
  values: ThetaRepository.ExposureCompensationEnum.values(), name: value as! String
223
235
  )!
236
+ case ThetaRepository.OptionNameEnum.ethernetconfig.name:
237
+ if let params = value as? [String: Any] {
238
+ options.ethernetConfig = toEthernetConfig(params: params)
239
+ }
224
240
  case ThetaRepository.OptionNameEnum.exposuredelay.name:
225
241
  options.exposureDelay = getEnumValue(
226
242
  values: ThetaRepository.ExposureDelayEnum.values(), name: value as! String
@@ -379,6 +395,10 @@ func convertResult(options: ThetaRepository.Options) -> [String: Any] {
379
395
  let burstOption = value as? ThetaRepository.BurstOption
380
396
  {
381
397
  result[key] = convertResult(burstOption: burstOption)
398
+ } else if value is ThetaRepository.EthernetConfig,
399
+ let ethernetConfig = value as? ThetaRepository.EthernetConfig
400
+ {
401
+ result[key] = convertResult(ethernetConfig: ethernetConfig)
382
402
  } else if value is ThetaRepository.GpsInfo {
383
403
  let gpsInfo = value as! ThetaRepository.GpsInfo
384
404
  result[key] = convertResult(gpsInfo: gpsInfo)
@@ -425,6 +445,12 @@ func toCaptureProgressNotifyParam(value: Float) -> [String: Any] {
425
445
  ]
426
446
  }
427
447
 
448
+ func toEventWebSocketEventNotifyParam(value: CameraEvent) -> [String: Any] {
449
+ return [
450
+ KEY_NOTIFY_PARAM_EVENT: convertResult(cameraEvent: value),
451
+ ]
452
+ }
453
+
428
454
  func toMessageNotifyParam(value: String) -> [String: Any] {
429
455
  return [
430
456
  KEY_NOTIFY_PARAM_MESSAGE: value,
@@ -821,28 +847,81 @@ func convertResult(cameraErrorList: [ThetaRepository.CameraErrorEnum]?) -> [Stri
821
847
  }
822
848
 
823
849
  func convertResult(thetaState: ThetaRepository.ThetaState) -> [String: Any?] {
824
- return [
825
- "fingerprint": thetaState.fingerprint,
826
- "batteryLevel": thetaState.batteryLevel,
827
- "storageUri": thetaState.storageUri,
828
- "storageID": thetaState.storageID,
829
- "captureStatus": thetaState.captureStatus.name,
830
- "recordedTime": thetaState.recordedTime,
831
- "recordableTime": thetaState.recordableTime,
832
- "capturedPictures": thetaState.capturedPictures,
833
- "compositeShootingElapsedTime": thetaState.compositeShootingElapsedTime,
834
- "latestFileUrl": thetaState.latestFileUrl,
835
- "chargingState": thetaState.chargingState.name,
836
- "apiVersion": thetaState.apiVersion,
837
- "isPluginRunning": convertKotlinBooleanToBool(value: thetaState.isPluginRunning),
838
- "isPluginWebServer": convertKotlinBooleanToBool(value: thetaState.isPluginWebServer),
839
- "function": thetaState.function?.name,
840
- "isMySettingChanged": convertKotlinBooleanToBool(value: thetaState.isMySettingChanged),
841
- "currentMicrophone": thetaState.currentMicrophone?.name,
842
- "isSdCard": convertKotlinBooleanToBool(value: thetaState.isSdCard),
843
- "cameraError": convertResult(cameraErrorList: thetaState.cameraError),
844
- "isBatteryInsert": convertKotlinBooleanToBool(value: thetaState.isBatteryInsert),
845
- ]
850
+ var result: [String: Any] = [:]
851
+ if let value = thetaState.fingerprint {
852
+ result["fingerprint"] = value
853
+ }
854
+ if let value = thetaState.batteryLevel {
855
+ result["batteryLevel"] = value
856
+ }
857
+ if let value = thetaState.storageUri {
858
+ result["storageUri"] = value
859
+ }
860
+ if let value = thetaState.storageID {
861
+ result["storageID"] = value
862
+ }
863
+ if let value = thetaState.captureStatus {
864
+ result["captureStatus"] = value.name
865
+ }
866
+ if let value = thetaState.recordedTime {
867
+ result["recordedTime"] = value
868
+ }
869
+ if let value = thetaState.recordableTime {
870
+ result["recordableTime"] = value
871
+ }
872
+ if let value = thetaState.capturedPictures {
873
+ result["capturedPictures"] = value
874
+ }
875
+ if let value = thetaState.compositeShootingElapsedTime {
876
+ result["compositeShootingElapsedTime"] = value
877
+ }
878
+ if let value = thetaState.latestFileUrl {
879
+ result["latestFileUrl"] = value
880
+ }
881
+ if let value = thetaState.chargingState {
882
+ result["chargingState"] = value.name
883
+ }
884
+ if let value = thetaState.apiVersion {
885
+ result["apiVersion"] = value
886
+ }
887
+ if let value = thetaState.isPluginRunning {
888
+ result["isPluginRunning"] = convertKotlinBooleanToBool(value: value)
889
+ }
890
+ if let value = thetaState.isPluginWebServer {
891
+ result["isPluginWebServer"] = convertKotlinBooleanToBool(value: value)
892
+ }
893
+ if let value = thetaState.function {
894
+ result["function"] = value.name
895
+ }
896
+ if let value = thetaState.isMySettingChanged {
897
+ result["isMySettingChanged"] = convertKotlinBooleanToBool(value: value)
898
+ }
899
+ if let value = thetaState.currentMicrophone {
900
+ result["currentMicrophone"] = value.name
901
+ }
902
+ if let value = thetaState.isSdCard {
903
+ result["isSdCard"] = convertKotlinBooleanToBool(value: value)
904
+ }
905
+ if let value = thetaState.cameraError {
906
+ result["cameraError"] = convertResult(cameraErrorList: value)
907
+ }
908
+ if let value = thetaState.isBatteryInsert {
909
+ result["isBatteryInsert"] = convertKotlinBooleanToBool(value: value)
910
+ }
911
+ if let value = thetaState.boardTemp {
912
+ result[KEY_STATE_BOARD_TEMP] = value
913
+ }
914
+ if let value = thetaState.batteryTemp {
915
+ result[KEY_STATE_BATTERY_TEMP] = value
916
+ }
917
+ if let externalGpsInfo = thetaState.externalGpsInfo {
918
+ result[KEY_STATE_EXTERNAL_GPS_INFO] = convertResult(stateGpsInfo: externalGpsInfo)
919
+ }
920
+ if let internalGpsInfo = thetaState.internalGpsInfo {
921
+ result[KEY_STATE_INTERNAL_GPS_INFO] = convertResult(stateGpsInfo: internalGpsInfo)
922
+ }
923
+
924
+ return result
846
925
  }
847
926
 
848
927
  func convertResult(burstOption: ThetaRepository.BurstOption) -> [String: Any] {
@@ -902,6 +981,23 @@ func convertResult(autoBracket: ThetaRepository.BracketSettingList) -> [[String:
902
981
  return resultList
903
982
  }
904
983
 
984
+ func convertResult(ethernetConfig: ThetaRepository.EthernetConfig) -> [String: Any] {
985
+ var result: [String: Any] = ["usingDhcp": ethernetConfig.usingDhcp]
986
+ if let ipAddress = ethernetConfig.ipAddress {
987
+ result[KEY_IP_ADDRESS] = ipAddress
988
+ }
989
+ if let subnetMask = ethernetConfig.subnetMask {
990
+ result[KEY_SUBNET_MASK] = subnetMask
991
+ }
992
+ if let defaultGateway = ethernetConfig.defaultGateway {
993
+ result[KEY_DEFAULT_GATEWAY] = defaultGateway
994
+ }
995
+ if let proxy = ethernetConfig.proxy {
996
+ result[KEY_PROXY] = convertResult(proxy: proxy)
997
+ }
998
+ return result
999
+ }
1000
+
905
1001
  func convertResult(gpsInfo: ThetaRepository.GpsInfo) -> [String: Any] {
906
1002
  return [
907
1003
  "latitude": gpsInfo.latitude,
@@ -911,6 +1007,13 @@ func convertResult(gpsInfo: ThetaRepository.GpsInfo) -> [String: Any] {
911
1007
  ]
912
1008
  }
913
1009
 
1010
+ func convertResult(stateGpsInfo: ThetaRepository.StateGpsInfo) -> [String: Any] {
1011
+ guard let gpsInfo = stateGpsInfo.gpsInfo else { return [:] }
1012
+ return [
1013
+ KEY_GPS_INFO: convertResult(gpsInfo: gpsInfo),
1014
+ ]
1015
+ }
1016
+
914
1017
  func convertResult(proxy: ThetaRepository.Proxy) -> [String: Any] {
915
1018
  var result: [String: Any] = [:]
916
1019
  result[KEY_PROXY_USE] = proxy.use
@@ -998,16 +1101,16 @@ func convertResult(accessPointList: [ThetaRepository.AccessPoint]) -> [[String:
998
1101
  result["connectionPriority"] = accessPoint.connectionPriority
999
1102
  result["usingDhcp"] = accessPoint.usingDhcp
1000
1103
  if let ipAddress = accessPoint.ipAddress {
1001
- result["ipAddress"] = ipAddress
1104
+ result[KEY_IP_ADDRESS] = ipAddress
1002
1105
  }
1003
1106
  if let subnetMask = accessPoint.subnetMask {
1004
- result["subnetMask"] = subnetMask
1107
+ result[KEY_SUBNET_MASK] = subnetMask
1005
1108
  }
1006
1109
  if let defaultGateway = accessPoint.defaultGateway {
1007
- result["defaultGateway"] = defaultGateway
1110
+ result[KEY_DEFAULT_GATEWAY] = defaultGateway
1008
1111
  }
1009
1112
  if let proxy = accessPoint.proxy {
1010
- result["proxy"] = convertResult(proxy: proxy)
1113
+ result[KEY_PROXY] = convertResult(proxy: proxy)
1011
1114
  }
1012
1115
  resultList.append(result)
1013
1116
  }
@@ -1034,6 +1137,19 @@ func toPluginInfosResult(pluginInfoList: [ThetaRepository.PluginInfo]) -> [[Stri
1034
1137
  return resultList
1035
1138
  }
1036
1139
 
1140
+ func convertResult(cameraEvent: CameraEvent) -> [String: Any]
1141
+ {
1142
+ var result = [String: Any]()
1143
+ if let value = cameraEvent.options {
1144
+ result[KEY_OPTIONS] = convertResult(options: value)
1145
+ }
1146
+ if let value = cameraEvent.state {
1147
+ result[KEY_STATE] = convertResult(thetaState: value)
1148
+ }
1149
+
1150
+ return result
1151
+ }
1152
+
1037
1153
  // MARK: - Convert to theta-client object
1038
1154
 
1039
1155
  func toBitrate(value: Any) -> ThetaRepositoryBitrate? {
@@ -1199,6 +1315,21 @@ func toAutoBracket(params: [[String: Any]]) -> ThetaRepository.BracketSettingLis
1199
1315
  return autoBracket
1200
1316
  }
1201
1317
 
1318
+ func toEthernetConfig(params: [String: Any]) -> ThetaRepository.EthernetConfig {
1319
+ var proxy: ThetaRepository.Proxy? = nil
1320
+ if let data = params[KEY_PROXY] as? [String: Any] {
1321
+ proxy = toProxy(params: data)
1322
+ }
1323
+
1324
+ return ThetaRepository.EthernetConfig(
1325
+ usingDhcp: params["usingDhcp"] as? Bool ?? true,
1326
+ ipAddress: params[KEY_IP_ADDRESS] as? String,
1327
+ subnetMask: params[KEY_SUBNET_MASK] as? String,
1328
+ defaultGateway: params[KEY_DEFAULT_GATEWAY] as? String,
1329
+ proxy: proxy
1330
+ )
1331
+ }
1332
+
1202
1333
  func toGpsInfo(params: [String: Any]) -> ThetaRepository.GpsInfo? {
1203
1334
  guard let latitude = params[KEY_GPS_LATITUDE] as? Double,
1204
1335
  let longitude = params[KEY_GPS_LONGITUDE] as? Double,