Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/1.5.0 #47

Merged
merged 77 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
22d7a2b
Implement ThetaRepository.updateFirmware() with hard coded API path
simago May 26, 2023
8195710
Move API path to environment variable. Actual getENvironmentVar() on…
simago May 29, 2023
8337677
Add comments to UpdateFirmwareTest class
simago May 29, 2023
111d424
Improve redundant descriptions
simago May 30, 2023
8c21945
Add documentation comments
simago May 30, 2023
e4eeda2
Add catch blocks to ThetaRepository.updateFirmware()
simago May 30, 2023
7fb48eb
Implement getEnvironmentVar() for iOS
ywatanabe-dev May 31, 2023
ea49d8a
Add comment to getEnvironmentVar() for iOS
ywatanabe-dev May 31, 2023
d130f44
Merge remote-tracking branch 'origin/feat/write-file-protcol' into fe…
simago May 31, 2023
3c612fb
Change the way to pass apiPath
simago May 31, 2023
b31d9cb
Replace getEnvironmentVar() with System.getenv()
simago Jun 7, 2023
13c0af4
Fix UpdateFirmwareTest
simago Jun 7, 2023
c230680
Add test
simago Jul 6, 2023
f7e0c82
Merge branch 'dev/1.3.0' into feat/write-file-protcol
simago Jul 6, 2023
fc6b58a
Add some http headers
simago Jul 7, 2023
52fb809
Change time out
simago Jul 10, 2023
ba988ad
Confirm v-up/v-dowm
simago Jul 11, 2023
d135a81
Rewrite test codes
simago Jul 12, 2023
15b004b
Refine test
simago Jul 12, 2023
bbc85c7
Delete unnecessary comment
simago Jul 12, 2023
46a88d9
Rename test file
simago Jul 12, 2023
1e1a795
Add test for Theta X
simago Jul 13, 2023
97456e9
Merge branch 'dev/1.3.0' into feat/write-file-protcol
simago Jul 13, 2023
303f768
write a test for Theta X
simago Jul 18, 2023
0c48bf6
Merge branch 'dev/1.3.0' into feat/write-file-protcol
simago Jul 18, 2023
016f076
Use client mode for Theta X
simago Jul 18, 2023
c0f283d
Change to read firmware from a file
simago Jul 31, 2023
53ea356
Add unit test
simago Jul 31, 2023
49b7e32
Change return type of request() from String to ByteArray
simago Jul 31, 2023
0c02a22
Sucess SC2B test
simago Aug 1, 2023
2e9fcb7
Change timeout settings
simago Aug 3, 2023
5bfbefd
Update FW version of Theta X
simago Aug 7, 2023
a96f05d
Improve some descriptions
simago Aug 8, 2023
d0a5c2c
Remove unused timeout
simago Aug 9, 2023
79fd46f
merge dev/1.4.0
simago Aug 28, 2023
9ef5467
Add callback to notify the percentage of transmission
simago Aug 28, 2023
4e45f0d
Update kotlin-gradle-plugin version
ywatanabe-dev Aug 29, 2023
b113e88
Set useMock true
simago Aug 29, 2023
e145a59
Improve exceptions of MultipartPostClient
simago Aug 31, 2023
127bae0
Improve exceptions of MultipartPostClient
simago Aug 31, 2023
f17b6e0
Improve exceptions of MultipartPostClient
simago Sep 1, 2023
eadc441
Improve exceptions of MultipartPostClient
simago Sep 1, 2023
6109dda
If head of apiPath is not a slash, add it
simago Sep 1, 2023
a2cc394
Remove println() for debug
simago Sep 1, 2023
f263077
On diget authentication, keep socket connection
simago Sep 4, 2023
8e7eac0
Improve updateFirmwareXTest()
simago Sep 6, 2023
b00fb24
Improve a check whether authentication is needed or not
simago Sep 7, 2023
66138f4
Change auth check command to /osc/state
simago Sep 8, 2023
b726141
Remove content-length header
simago Sep 8, 2023
edf68d9
Add host header and accept header
simago Sep 11, 2023
ac50523
Change condition for file upload
simago Sep 12, 2023
d75b082
Add delay before close SelectorManager
simago Sep 14, 2023
750cedb
Add delay before close SelectorManager
simago Sep 14, 2023
7ae494a
Make not call SelectorManager.close()
simago Sep 14, 2023
6bfaadf
Pass 100 to callback function
simago Sep 15, 2023
243b1df
Support other camera
osakila Sep 19, 2023
e20a203
Limit requests to a single connection
osakila Sep 20, 2023
d082f90
Close previewClient before update firmware
simago Sep 21, 2023
4eee75c
Merge dev/1.5.0
ywatanabe-dev Sep 21, 2023
a731cdc
Merge dev/1.5.0
ywatanabe-dev Sep 22, 2023
73bb5a5
Remove `previewClient.close()` before firm update
ywatanabe-dev Sep 22, 2023
1f12f99
Allow endpont URL without last slash
simago Sep 22, 2023
5ca52cc
Remove magic numbers
simago Sep 22, 2023
0c77048
Supress some Detect messages
simago Sep 25, 2023
9eccce7
Make some objects internal
simago Sep 25, 2023
f93e628
Supress CyclomaticComplexMethod to some functions
simago Sep 25, 2023
c2c76d7
add limitless interval shooting
LassicYM Sep 28, 2023
84b1419
Improve codes regarding to nullable type
simago Sep 28, 2023
0694c29
Minor fixes
simago Sep 28, 2023
5e05132
Make some class internal
simago Oct 3, 2023
cc714ab
Add options _latestExposureDelayTime, videoStitching, and _visibility…
ywatanabe-dev Oct 3, 2023
4c900c1
Merge pull request #214 from ricohapi/feat/write-file-protcol-1.5.0
simago Oct 3, 2023
c694e22
add options _topBottomCorrection and _topBottomCorrectionRotation.
LassicYM Oct 4, 2023
018d1b6
Add tests of get/set options LatestEnabledExposureDelayTime, VideoSti…
ywatanabe-dev Oct 16, 2023
cac2ff0
add interval shooting with the shot count specified
LassicYM Oct 20, 2023
97c047a
Fix type of 'function' property of ThetaState on ReactNative
ywatanabe-dev Oct 23, 2023
43f7a68
update version 1.5.0 and format code.
LassicYM Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20")
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.8.20")
classpath("org.jetbrains.dokka:versioning-plugin:1.8.20")
Expand Down
32 changes: 16 additions & 16 deletions config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ complexity:
# threshold: 10
# includeStaticDeclarations: false
# includePrivateDeclarations: false
# ComplexMethod:
# active: true
# threshold: 15
ComplexMethod:
active: true
threshold: 20
# ignoreSingleWhenExpression: false
# ignoreSimpleWhenEntries: false
# ignoreNestingFunctions: false
Expand Down Expand Up @@ -237,13 +237,13 @@ exceptions:
# active: false
# PrintStackTrace:
# active: true
# RethrowCaughtException:
# active: true
RethrowCaughtException:
active: false
# ReturnFromFinally:
# active: true
# ignoreLabeled: false
# SwallowedException:
# active: true
SwallowedException:
active: false
# ignoredExceptionTypes:
# - 'InterruptedException'
# - 'MalformedURLException'
Expand Down Expand Up @@ -282,8 +282,8 @@ exceptions:
# - 'RuntimeException'
# - 'Throwable'
# allowedExceptionNameRegex: '_|(ignore|expected).*'
# TooGenericExceptionThrown:
# active: true
TooGenericExceptionThrown:
active: false
# exceptionNames:
# - 'Error'
# - 'Exception'
Expand Down Expand Up @@ -546,9 +546,9 @@ style:
# LibraryEntitiesShouldNotBePublic:
# active: true
# excludes: [ '**' ]
# LoopWithTooManyJumpStatements:
# active: true
# maxJumpCount: 1
LoopWithTooManyJumpStatements:
active: true
maxJumpCount: 3
MagicNumber:
active: true
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
Expand Down Expand Up @@ -620,10 +620,10 @@ style:
# active: true
# SpacingBetweenPackageAndImports:
# active: false
# ThrowsCount:
# active: true
# max: 2
# excludeGuardClauses: false
ThrowsCount:
active: true
max: 8
excludeGuardClauses: false
# TrailingWhitespace:
# active: false
# UnderscoresInNumericLiterals:
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,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.1.3"
implementation "com.ricoh360.thetaclient:theta-client:1.4.0"
implementation "com.ricoh360.thetaclient:theta-client:1.5.0"

testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@ import timber.log.Timber
fun PreviewScreen(toPhoto: (photoUrl: String) -> Unit, viewModel: ThetaViewModel = androidx.lifecycle.viewmodel.compose.viewModel()) {

class TakenCallback : PhotoCapture.TakePictureCallback {
override fun onSuccess(fileUrl: String) {
override fun onSuccess(fileUrl: String?) {
Timber.i("takePicture onSuccess: $fileUrl")
val scope = CoroutineScope(Job() + Dispatchers.Main)
scope.launch {
toPhoto(fileUrl) // need to execute on the main thread.
when (fileUrl) {
null -> { // Cancel shooting.
viewModel.startPreview()
}

else -> {
scope.launch {
toPhoto(fileUrl) // need to execute on the main thread.
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion demos/demo-flutter/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
Expand Down
31 changes: 18 additions & 13 deletions demos/demo-flutter/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
final _thetaClientFlutter = ThetaClientFlutter();
bool _isInitTheta = false;
bool _initializing = false;
ThetaModel? _thetaModel;

final String endpoint = 'http://192.168.1.1:80/';

Expand Down Expand Up @@ -76,20 +77,20 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
return;
}
bool isInitTheta;
ThetaModel? thetaModel;
try {
_initializing = true;
isInitTheta = await _thetaClientFlutter.isInitialized();
if (!isInitTheta) {
_initializing = true;
debugPrint('start initialize');
await _thetaClientFlutter.initialize(endpoint);

// // Client mode authentication settings
// final config = ThetaConfig();
// config.clientMode = DigestAuth('THETAXX12345678', '12345678');
// await _thetaClientFlutter.initialize(endpoint, config);

isInitTheta = true;
}
debugPrint('start initialize');
await _thetaClientFlutter.initialize(endpoint);
thetaModel = await _thetaClientFlutter.getThetaModel();

// // Client mode authentication settings
// final config = ThetaConfig();
// config.clientMode = DigestAuth('THETAXX12345678', '12345678');
// await _thetaClientFlutter.initialize(endpoint, config);

isInitTheta = true;
} on PlatformException {
if (!mounted) return;
debugPrint('Error. init');
Expand All @@ -103,6 +104,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {

setState(() {
_isInitTheta = isInitTheta;
_thetaModel = thetaModel;
});
}

Expand All @@ -114,6 +116,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
platformVersion: _platformVersion,
isInitialized: _isInitTheta,
connectTheta: initTheta,
thetaModel: _thetaModel,
),
);
}
Expand All @@ -123,16 +126,18 @@ class Home extends StatelessWidget {
final String platformVersion;
final bool isInitialized;
final Function connectTheta;
final ThetaModel? thetaModel;
const Home({Key? key,
required this.platformVersion,
required this.isInitialized,
required this.connectTheta,
required this.thetaModel,
}) : super(key: key);


@override
Widget build(BuildContext context) {
String camera = isInitialized ? 'connected!': 'disconnected';
String camera = isInitialized ? 'connected! $thetaModel': 'disconnected';
return Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
Expand Down
19 changes: 13 additions & 6 deletions demos/demo-flutter/lib/take_picture_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,20 @@ class _TakePictureScreen extends State<TakePictureScreen> with WidgetsBindingObs
});
debugPrint('take picture: $fileUrl');
if (!mounted) return;
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => PhotoScreen(
name: 'Take Picture',
fileUrl: fileUrl,
if (fileUrl != null) {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => PhotoScreen(
name: 'Take Picture',
fileUrl: fileUrl,
)
)
)
).then((value) => startLivePreview());
).then((value) => startLivePreview());
} else {
setState(() {
shooting = true;
});
debugPrint('takePicture canceled.');
}
}, (exception) {
setState(() {
shooting = false;
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.4.0'
pod 'THETAClient', '1.5.0'
end
15 changes: 9 additions & 6 deletions demos/demo-ios/SdkSample/TakePhotoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,15 @@ struct TakePhotoView: View {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
Task {
do {
try await theta.takePicture {photoUrl in
let parts = photoUrl.components(separatedBy: "/")
item = FileItem(
name: parts[parts.count - 1],
url: photoUrl
)
try await theta.takePicture { photoUrl in
// When nil, it is canceled.
if let photoUrl {
let parts = photoUrl.components(separatedBy: "/")
item = FileItem(
name: parts[parts.count - 1],
url: photoUrl
)
}
isActive = true
}
} catch {
Expand Down
13 changes: 6 additions & 7 deletions demos/demo-ios/SdkSample/ThetaSdk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class Theta {
completionHandler(response)
}

func takePicture(_ callback: @escaping (_ url: String) -> Void) async throws {
func takePicture(_ callback: @escaping (_ url: String?) -> Void) async throws {
try await initialize()
let photoCapture: PhotoCapture = try await withCheckedThrowingContinuation {continuation in
thetaRepository!.getPhotoCaptureBuilder()
Expand All @@ -144,23 +144,22 @@ class Theta {
init(_ callback: @escaping (_ url: String?, _ error: Error?) -> Void) {
self.callback = callback
}
func onSuccess(fileUrl: String) {
func onSuccess(fileUrl: String?) {
callback(fileUrl, nil)
}
func onProgress(completion: Float) {
}
func onError(exception: ThetaException) {
callback(nil, exception as? Error)
callback(nil, exception.asError())
}
}
let photoUrl: String = try await withCheckedThrowingContinuation {continuation in
let photoUrl: String? = try await withCheckedThrowingContinuation {continuation in
photoCapture.takePicture(
callback: Callback {fileUrl, error in
if let photoUrl = fileUrl {
continuation.resume(returning: photoUrl)
}
if let thetaError = error {
continuation.resume(throwing: thetaError)
} else {
continuation.resume(returning: fileUrl)
}
}
)
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@react-navigation/native": "^6.1.0",
"@react-navigation/native-stack": "^6.9.5",
"theta-client-react-native": "1.4.0",
"theta-client-react-native": "1.5.0",
"react": "18.2.0",
"react-native": "0.70.6",
"react-native-safe-area-context": "^4.4.1",
Expand Down
4 changes: 2 additions & 2 deletions flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group 'com.ricoh360.thetaclient.theta_client_flutter'
version '1.0.0'

buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.20'
repositories {
google()
mavenCentral()
Expand Down Expand Up @@ -53,5 +53,5 @@ dependencies {
implementation("io.ktor:ktor-serialization-kotlinx-json:2.1.2")
implementation("com.soywiz.korlibs.krypto:krypto:3.4.0")

implementation("com.ricoh360.thetaclient:theta-client:1.4.0")
implementation("com.ricoh360.thetaclient:theta-client:1.5.0")
}
Loading
Loading