• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

OPC(Olympus Air)用望遠鏡アプリ。


Commit MetaInfo

Révisionb3b23ebc148a5cd16d34df881e0282cd11c7f773 (tree)
l'heure2018-07-05 23:59:36
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

撮影機能を搭載。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/RicohGr2CameraCaptureControl.java
@@ -1,13 +1,30 @@
11 package net.osdn.gokigen.a01d.camera.ricohgr2.operation;
22
3+import android.support.annotation.NonNull;
4+
35 import net.osdn.gokigen.a01d.camera.ICaptureControl;
6+import net.osdn.gokigen.a01d.camera.ricohgr2.operation.takepicture.RicohGr2SingleShotControl;
7+import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
48
59 public class RicohGr2CameraCaptureControl implements ICaptureControl
610 {
11+ private final RicohGr2SingleShotControl singleShotControl;
12+
13+ public RicohGr2CameraCaptureControl(@NonNull IAutoFocusFrameDisplay frameDisplayer)
14+ {
15+ singleShotControl = new RicohGr2SingleShotControl(frameDisplayer);
16+ }
717
818 @Override
919 public void doCapture(int kind)
1020 {
11-
21+ try
22+ {
23+ singleShotControl.singleShot();
24+ }
25+ catch (Exception e)
26+ {
27+ e.printStackTrace();
28+ }
1229 }
1330 }
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/takepicture/RicohGr2AutoFocusControl.java
@@ -181,7 +181,6 @@ public class RicohGr2AutoFocusControl
181181 boolean afResult = false;
182182 try
183183 {
184- int indexOfTouchAFPositionResult = 1;
185184 JSONObject resultObject = new JSONObject(replyString);
186185 String result = resultObject.getString("errMsg");
187186 boolean focused = resultObject.getBoolean("focused");
--- /dev/null
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/takepicture/RicohGr2SingleShotControl.java
@@ -0,0 +1,68 @@
1+package net.osdn.gokigen.a01d.camera.ricohgr2.operation.takepicture;
2+
3+import android.support.annotation.NonNull;
4+import android.util.Log;
5+
6+import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
7+import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
8+
9+/**
10+ *
11+ *
12+ *
13+ */
14+public class RicohGr2SingleShotControl
15+{
16+ private static final String TAG = RicohGr2SingleShotControl.class.getSimpleName();
17+ private final String shootUrl = "http://192.168.0.1/v1/camera/shoot";
18+ private final IAutoFocusFrameDisplay frameDisplayer;
19+ private int timeoutMs = 6000;
20+
21+ /**
22+ *
23+ *
24+ */
25+ public RicohGr2SingleShotControl(@NonNull IAutoFocusFrameDisplay frameDisplayer)
26+ {
27+ this.frameDisplayer = frameDisplayer;
28+ }
29+
30+ /**
31+ *
32+ *
33+ */
34+ public void singleShot()
35+ {
36+ Log.v(TAG, "singleShot()");
37+ try
38+ {
39+ Thread thread = new Thread(new Runnable()
40+ {
41+ @Override
42+ public void run()
43+ {
44+ try
45+ {
46+ String postData = "af=camera";
47+ String result = SimpleHttpClient.httpPost(shootUrl, postData, timeoutMs);
48+ if ((result == null)||(result.length() < 1))
49+ {
50+ Log.v(TAG, "singleShot() reply is null.");
51+ }
52+ }
53+ catch (Exception e)
54+ {
55+ e.printStackTrace();
56+ }
57+ frameDisplayer.hideFocusFrame();
58+ }
59+ });
60+ thread.start();
61+ }
62+ catch (Exception e)
63+ {
64+ e.printStackTrace();
65+ }
66+ }
67+
68+}
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2InterfaceProvider.java
@@ -47,7 +47,6 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
4747 this.provider = provider;
4848 gr2Connection = new RicohGr2Connection(context, provider);
4949 liveViewControl = new RicohGr2LiveViewControl();
50- captureControl = new RicohGr2CameraCaptureControl();
5150 zoomControl = new RicohGr2CameraZoomLensControl();
5251
5352 }
@@ -70,7 +69,7 @@ public class RicohGr2InterfaceProvider implements IRicohGr2InterfaceProvider, ID
7069 {
7170 Log.v(TAG, "injectDisplay()");
7271 focusControl = new RicohGr2CameraFocusControl(frameDisplayer, indicator);
73-
72+ captureControl = new RicohGr2CameraCaptureControl(frameDisplayer);
7473 }
7574
7675 /**
Afficher sur ancien navigateur de dépôt.