Skip to content

Commit

Permalink
Merge pull request #93 from ricohapi/dev/1.11.0
Browse files Browse the repository at this point in the history
Dev/1.11.0
  • Loading branch information
LassicYM authored Oct 30, 2024
2 parents d1871d6 + 832cae6 commit ab9e33f
Show file tree
Hide file tree
Showing 60 changed files with 913 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-kmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
arguments: testReleaseUnitTest --info
- name: Archive code coverage results
if: always()
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: test-kmp-report
path: kotlin-multiplatform/build/reports/tests/testReleaseUnitTest
2 changes: 1 addition & 1 deletion .github/workflows/test-rn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
yarn test --collectCoverage
- name: Archive code coverage results
if: always()
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: test-react-native-report
path: react-native/coverage
2 changes: 1 addition & 1 deletion demos/demo-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies {
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation 'io.coil-kt:coil-compose:2.2.2'
implementation "io.ktor:ktor-client-cio:2.3.9"
implementation "com.ricoh360.thetaclient:theta-client:1.10.2"
implementation "com.ricoh360.thetaclient:theta-client:1.11.0"

testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ target 'SdkSample' do
use_frameworks!

# Pods for SdkSample
pod 'THETAClient', '1.10.2'
pod 'THETAClient', '1.11.0'
end
2 changes: 1 addition & 1 deletion demos/demo-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@react-navigation/native": "^6.1.0",
"@react-navigation/native-stack": "^6.9.5",
"theta-client-react-native": "1.10.2",
"theta-client-react-native": "1.11.0",
"react": "18.2.0",
"react-native": "0.71.14",
"react-native-safe-area-context": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-android.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- モジュールの`build.gradle``dependencies`に次を追加します。
```
implementation "com.ricoh360.thetaclient:theta-client:1.10.2"
implementation "com.ricoh360.thetaclient:theta-client:1.11.0"
```
- 本 SDK を使用したアプリケーションが動作するスマートフォンと THETA を無線 LAN 接続しておきます。

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Add following descriptions to the `dependencies` of your module's `build.gradle`.

```
implementation "com.ricoh360.thetaclient:theta-client:1.10.2"
implementation "com.ricoh360.thetaclient:theta-client:1.11.0"
```

- Connect the wireless LAN between THETA and the smartphone that runs on the application using this SDK.
Expand Down
2 changes: 1 addition & 1 deletion flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ dependencies {
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.9")
implementation("com.soywiz.korlibs.krypto:krypto:4.0.10")

implementation("com.ricoh360.thetaclient:theta-client:1.10.2")
implementation("com.ricoh360.thetaclient:theta-client:1.11.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const val KEY_NOTIFY_PARAM_COMPLETION = "completion"
const val KEY_NOTIFY_PARAM_IMAGE = "image"
const val KEY_NOTIFY_PARAM_MESSAGE = "message"
const val KEY_NOTIFY_PARAM_STATUS = "status"
const val KEY_NOTIFY_PARAM_FILE_URL = "fileUrl"
const val KEY_GPS_INFO = "gpsInfo"
const val KEY_STATE_EXTERNAL_GPS_INFO = "externalGpsInfo"
const val KEY_STATE_INTERNAL_GPS_INFO = "internalGpsInfo"
Expand Down Expand Up @@ -734,6 +735,7 @@ fun getOptionValueEnum(name: OptionNameEnum, valueName: String): Any? {
OptionNameEnum.BurstMode -> BurstModeEnum.values().find { it.name == valueName }
OptionNameEnum.CameraControlSource -> CameraControlSourceEnum.values().find { it.name == valueName }
OptionNameEnum.CameraMode -> CameraModeEnum.values().find { it.name == valueName }
OptionNameEnum.CameraPower -> CameraPowerEnum.values().find { it.name == valueName }
OptionNameEnum.CaptureMode -> CaptureModeEnum.values().find { it.name == valueName }
OptionNameEnum.ContinuousNumber -> ContinuousNumberEnum.values().find { it.name == valueName }
OptionNameEnum.ExposureCompensation -> ExposureCompensationEnum.values().find { it.name == valueName }
Expand Down Expand Up @@ -928,3 +930,9 @@ fun toCapturingNotifyParam(status: CapturingStatusEnum): Map<String, Any> {
KEY_NOTIFY_PARAM_STATUS to status.name
)
}

fun toStartedNotifyParam(value: String): Map<String, Any> {
return mapOf<String, Any>(
KEY_NOTIFY_PARAM_FILE_URL to value
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ThetaClientFlutterPlugin : FlutterPlugin, MethodCallHandler {
const val messageNotInit: String = "Not initialized."
const val messageNoResult: String = "Result is Null."
const val messageNoArgument: String = "No Argument."
const val messageLivePreviewRunning: String = "Live preview is running."

const val eventNameNotify = "theta_client_flutter/theta_notify"
const val notifyIdLivePreview = 10001
Expand All @@ -85,6 +86,7 @@ class ThetaClientFlutterPlugin : FlutterPlugin, MethodCallHandler {
const val notifyIdPhotoCapturing = 10071
const val notifyIdVideoCaptureStopError = 10081
const val notifyIdVideoCaptureCapturing = 10082
const val notifyIdVideoCaptureStarted = 10083
}

fun sendNotifyEvent(id: Int, params: Map<String, Any?>) {
Expand Down Expand Up @@ -616,6 +618,11 @@ class ThetaClientFlutterPlugin : FlutterPlugin, MethodCallHandler {
}

suspend fun getLivePreview(result: Result) {
if (previewing) {
result.error(errorCode, messageLivePreviewRunning, null)
return
}

val theta = thetaRepository
if (theta == null) {
result.error(errorCode, messageNotInit, null)
Expand All @@ -632,13 +639,14 @@ class ThetaClientFlutterPlugin : FlutterPlugin, MethodCallHandler {
}
result.success(null)
} catch (e: Exception) {
previewing = false
result.error(e.javaClass.simpleName, e.message, null)
}
}

fun stopLivePreview(result: Result) {
previewing = false
result.success(null)
result.success(true)
}

fun getPhotoCaptureBuilder(result: Result) {
Expand Down Expand Up @@ -819,6 +827,13 @@ class ThetaClientFlutterPlugin : FlutterPlugin, MethodCallHandler {
toCapturingNotifyParam(status)
)
}

override fun onCaptureStarted(fileUrl: String?) {
sendNotifyEvent(
notifyIdVideoCaptureStarted,
toStartedNotifyParam(fileUrl ?: "")
)
}
})
}

Expand Down
9 changes: 9 additions & 0 deletions flutter/ios/Classes/ConvertUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let KEY_NOTIFY_PARAM_COMPLETION = "completion"
let KEY_NOTIFY_PARAM_IMAGE = "image"
let KEY_NOTIFY_PARAM_MESSAGE = "message"
let KEY_NOTIFY_PARAM_STATUS = "status"
let KEY_NOTIFY_PARAM_FILE_URL = "fileUrl"
let KEY_GPS_INFO = "gpsInfo"
let KEY_STATE_EXTERNAL_GPS_INFO = "externalGpsInfo"
let KEY_STATE_INTERNAL_GPS_INFO = "internalGpsInfo"
Expand Down Expand Up @@ -863,6 +864,8 @@ func setOptionsValue(options: ThetaRepository.Options, name: String, value: Any)
options.cameraControlSource = getEnumValue(values: ThetaRepository.CameraControlSourceEnum.values(), name: value as! String)!
case ThetaRepository.OptionNameEnum.cameramode.name:
options.cameraMode = getEnumValue(values: ThetaRepository.CameraModeEnum.values(), name: value as! String)!
case ThetaRepository.OptionNameEnum.camerapower.name:
options.cameraPower = getEnumValue(values: ThetaRepository.CameraPowerEnum.values(), name: value as! String)!
case ThetaRepository.OptionNameEnum.captureinterval.name:
options.captureInterval = KotlinInt(integerLiteral: value as! Int)
case ThetaRepository.OptionNameEnum.capturemode.name:
Expand Down Expand Up @@ -1126,3 +1129,9 @@ func toCapturingNotifyParam(value: CapturingStatusEnum) -> [String: Any] {
KEY_NOTIFY_PARAM_STATUS: value.name,
]
}

func toStartedNotifyParam(value: String) -> [String: Any] {
return [
KEY_NOTIFY_PARAM_FILE_URL: value,
]
}
19 changes: 18 additions & 1 deletion flutter/ios/Classes/SwiftThetaClientFlutterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let NOTIFY_CONTINUOUS_CAPTURING = 10062
let NOTIFY_PHOTO_CAPTURING = 10071
let NOTIFY_VIDEO_CAPTURE_STOP_ERROR = 10081
let NOTIFY_VIDEO_CAPTURE_CAPTURING = 10082
let NOTIFY_VIDEO_CAPTURE_STARTED = 10083

public class SwiftThetaClientFlutterPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
public func onListen(withArguments _: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
Expand All @@ -43,6 +44,7 @@ public class SwiftThetaClientFlutterPlugin: NSObject, FlutterPlugin, FlutterStre
static let messageNotInit: String = "Not initialized."
static let messageNoResult: String = "Result is Null."
static let messageNoArgument: String = "No Argument."
static let messageLivePreviewRunning = "Live preview is running."
static var endPoint: String = "http://192.168.1.1"
var eventSink: FlutterEventSink? = nil
var previewing = false
Expand Down Expand Up @@ -113,7 +115,7 @@ public class SwiftThetaClientFlutterPlugin: NSObject, FlutterPlugin, FlutterStre
case "getLivePreview":
getLivePreview(result: result)
case "stopLivePreview":
previewing = false
stopLivePreview(result: result)
case "listFiles":
listFiles(call: call, result: result)
case "deleteFiles":
Expand Down Expand Up @@ -382,6 +384,12 @@ public class SwiftThetaClientFlutterPlugin: NSObject, FlutterPlugin, FlutterStre
}

func getLivePreview(result: @escaping FlutterResult) {
if previewing {
let flutterError = FlutterError(code: SwiftThetaClientFlutterPlugin.errorCode, message: SwiftThetaClientFlutterPlugin.messageLivePreviewRunning, details: nil)
result(flutterError)
return
}

if thetaRepository == nil {
let flutterError = FlutterError(code: SwiftThetaClientFlutterPlugin.errorCode, message: SwiftThetaClientFlutterPlugin.messageNotInit, details: nil)
result(flutterError)
Expand Down Expand Up @@ -417,6 +425,11 @@ public class SwiftThetaClientFlutterPlugin: NSObject, FlutterPlugin, FlutterStre
}
}
}

func stopLivePreview(result: @escaping FlutterResult) {
previewing = false
result(true)
}

func listFiles(call: FlutterMethodCall, result: @escaping FlutterResult) {
guard let thetaRepository = thetaRepository else {
Expand Down Expand Up @@ -738,6 +751,10 @@ public class SwiftThetaClientFlutterPlugin: NSObject, FlutterPlugin, FlutterStre
func onCapturing(status: CapturingStatusEnum) {
plugin?.sendNotifyEvent(id: NOTIFY_VIDEO_CAPTURE_CAPTURING, params: toCapturingNotifyParam(value: status))
}

func onCaptureStarted(fileUrl: String?) {
plugin?.sendNotifyEvent(id: NOTIFY_VIDEO_CAPTURE_STARTED, params: toStartedNotifyParam(value: fileUrl ?? ""))
}
}
videoCapturing = videoCapture!.startCapture(
callback: Callback({ fileUrl, error in
Expand Down
4 changes: 2 additions & 2 deletions flutter/ios/theta_client_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'theta_client_flutter'
s.version = '1.10.2'
s.version = '1.11.0'
s.summary = 'theta-client plugin project.'
s.description = <<-DESC
theta-client Flutter plugin project.
Expand All @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
s.dependency 'Flutter'
s.platform = :ios, '15.0'

s.dependency 'THETAClient', '1.10.2'
s.dependency 'THETAClient', '1.11.0'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
Expand Down
5 changes: 3 additions & 2 deletions flutter/lib/capture/capture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ class VideoCapture extends Capture {
VideoCapturing startCapture(void Function(String? fileUrl) onCaptureCompleted,
void Function(Exception exception) onCaptureFailed,
{void Function(Exception exception)? onStopFailed,
void Function(CapturingStatusEnum status)? onCapturing}) {
void Function(CapturingStatusEnum status)? onCapturing,
void Function(String? fileUrl)? onCaptureStarted}) {
ThetaClientFlutterPlatform.instance
.startVideoCapture(onStopFailed, onCapturing)
.startVideoCapture(onStopFailed, onCapturing, onCaptureStarted)
.then((value) => onCaptureCompleted(value))
.onError((error, stackTrace) => onCaptureFailed(error as Exception));
return VideoCapturing();
Expand Down
36 changes: 36 additions & 0 deletions flutter/lib/options/camera_power.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// _cameraPower is the power status of camera.
///
/// For RICOH THETA X v2.61.0 or later
enum CameraPowerEnum {
/// Undefined value
unknown('UNKNOWN'),

/// Power ON
on('ON'),

/// Power OFF
off('OFF'),

/// Power on, power saving mode. Camera is closed.
/// Unavailable parameter when plugin is running. In this case, invalidParameterValue error will be returned.
powerSaving('POWER_SAVING'),

/// Power on, silent mode. LCD/LED is turned off.
/// Unavailable parameter when plugin is running. In this case, invalidParameterValue error will be returned.
silentMode('SILENT_MODE');

final String rawValue;

const CameraPowerEnum(this.rawValue);

@override
String toString() {
return rawValue;
}

static CameraPowerEnum? getValue(String rawValue) {
return CameraPowerEnum.values.cast<CameraPowerEnum?>().firstWhere(
(element) => element?.rawValue == rawValue,
orElse: () => null);
}
}
1 change: 1 addition & 0 deletions flutter/lib/options/importer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
library;

export 'bluetooth_role.dart';
export 'camera_power.dart';
export 'ethernet_config.dart';
export 'file_format.dart';
export 'max_recordable_time.dart';
Expand Down
11 changes: 11 additions & 0 deletions flutter/lib/theta_client_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@ enum OptionNameEnum {
/// Option name _cameraMode
cameraMode('CameraMode', CameraModeEnum),

/// Option name _cameraPower
cameraPower('CameraPower', CameraPowerEnum),

/// Option name captureInterval
captureInterval('CaptureInterval', int),

Expand Down Expand Up @@ -3253,6 +3256,9 @@ class Options {
/// For RICOH THETA X
CameraModeEnum? cameraMode;

/// see [CameraPowerEnum]
CameraPowerEnum? cameraPower;

/// Shooting interval (sec.) for interval shooting.
///
/// ### Support value
Expand Down Expand Up @@ -3526,6 +3532,8 @@ class Options {
return cameraControlSource as T;
case OptionNameEnum.cameraMode:
return cameraMode as T;
case OptionNameEnum.cameraPower:
return cameraPower as T;
case OptionNameEnum.captureInterval:
return captureInterval as T;
case OptionNameEnum.captureMode:
Expand Down Expand Up @@ -3664,6 +3672,9 @@ class Options {
case OptionNameEnum.cameraMode:
cameraMode = value;
break;
case OptionNameEnum.cameraPower:
cameraPower = value;
break;
case OptionNameEnum.captureInterval:
captureInterval = value;
break;
Expand Down
Loading

0 comments on commit ab9e33f

Please sign in to comment.