• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

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


Commit MetaInfo

Révision23702ad8a1ef573e1ee87b45edd54f6add2b6dbb (tree)
l'heure2018-06-14 00:29:26
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

SONY機でのZoomin / Zoomoutボタンの制御を追加した。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/operation/SonyCameraZoomLensControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/operation/SonyCameraZoomLensControl.java
@@ -1,18 +1,28 @@
11 package net.osdn.gokigen.a01d.camera.sony.operation;
22
3+import android.support.annotation.NonNull;
34 import android.util.Log;
45
56 import net.osdn.gokigen.a01d.camera.IZoomLensControl;
7+import net.osdn.gokigen.a01d.camera.sony.wrapper.ISonyCameraApi;
8+
9+import org.json.JSONObject;
610
711 public class SonyCameraZoomLensControl implements IZoomLensControl
812 {
913 private final String TAG = toString();
14+ private ISonyCameraApi cameraApi = null;
1015
1116 public SonyCameraZoomLensControl()
1217 {
1318 Log.v(TAG, "SonyCameraZoomLensControl()");
1419 }
1520
21+ public void setCameraApi(@NonNull ISonyCameraApi sonyCameraApi)
22+ {
23+ cameraApi = sonyCameraApi;
24+ }
25+
1626 @Override
1727 public boolean canZoom() {
1828 Log.v(TAG, "canZoom()");
@@ -53,12 +63,6 @@ public class SonyCameraZoomLensControl implements IZoomLensControl
5363 }
5464
5565 @Override
56- public void driveZoomLens(boolean isZoomIn)
57- {
58- Log.v(TAG, "driveZoomLens() : " + isZoomIn);
59- }
60-
61- @Override
6266 public void moveInitialZoomPosition()
6367 {
6468 Log.v(TAG, "moveInitialZoomPosition()");
@@ -70,4 +74,49 @@ public class SonyCameraZoomLensControl implements IZoomLensControl
7074 Log.v(TAG, "isDrivingZoomLens()");
7175 return (false);
7276 }
77+
78+ /**
79+ *
80+ *
81+ */
82+ @Override
83+ public void driveZoomLens(boolean isZoomIn)
84+ {
85+ Log.v(TAG, "driveZoomLens() : " + isZoomIn);
86+ if (cameraApi == null)
87+ {
88+ Log.v(TAG, "ISonyCameraApi is null...");
89+ return;
90+ }
91+ try
92+ {
93+ final String direction = (isZoomIn) ? "in" : "out";
94+ final String movement = "1shot";
95+ Thread thread = new Thread(new Runnable()
96+ {
97+ @Override
98+ public void run()
99+ {
100+ try
101+ {
102+ JSONObject resultsObj = cameraApi.actZoom(direction, movement);
103+ if (resultsObj == null)
104+ {
105+ Log.v(TAG, "driveZoomLens() reply is null.");
106+ }
107+ }
108+ catch (Exception e)
109+ {
110+ e.printStackTrace();
111+ }
112+ }
113+ });
114+ thread.start();
115+ }
116+ catch (Exception e)
117+ {
118+ e.printStackTrace();
119+ }
120+ }
121+
73122 }
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/SonyCameraApi.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/SonyCameraApi.java
@@ -293,7 +293,7 @@ class SonyCameraApi implements ISonyCameraApi
293293 public JSONObject actZoom(@NonNull String direction, @NonNull String movement)
294294 {
295295 try {
296- return (communicateJSON("camera", "stopMovieRec", new JSONArray().put(direction).put(movement), "1.0", -1));
296+ return (communicateJSON("camera", "actZoom", new JSONArray().put(direction).put(movement), "1.0", -1));
297297 } catch (Exception e) {
298298 e.printStackTrace();
299299 }
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/SonyCameraWrapper.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/SonyCameraWrapper.java
@@ -16,6 +16,7 @@ import net.osdn.gokigen.a01d.camera.olympus.wrapper.IFocusingModeNotify;
1616 import net.osdn.gokigen.a01d.camera.sony.ISonyInterfaceProvider;
1717 import net.osdn.gokigen.a01d.camera.sony.operation.SonyCameraCaptureControl;
1818 import net.osdn.gokigen.a01d.camera.sony.operation.SonyCameraFocusControl;
19+import net.osdn.gokigen.a01d.camera.sony.operation.SonyCameraZoomLensControl;
1920 import net.osdn.gokigen.a01d.camera.sony.wrapper.connection.SonyCameraConnection;
2021 import net.osdn.gokigen.a01d.camera.sony.wrapper.eventlistener.CameraEventObserver;
2122 import net.osdn.gokigen.a01d.camera.sony.wrapper.eventlistener.ICameraChangeListener;
@@ -35,6 +36,7 @@ public class SonyCameraWrapper implements ISonyCameraHolder, ISonyInterfaceProvi
3536 private SonyLiveViewControl liveViewControl = null;
3637 private SonyCameraFocusControl focusControl = null;
3738 private SonyCameraCaptureControl captureControl = null;
39+ private SonyCameraZoomLensControl zoomControl = null;
3840
3941 public SonyCameraWrapper(final Activity context, final ICameraStatusReceiver statusReceiver)
4042 {
@@ -46,12 +48,20 @@ public class SonyCameraWrapper implements ISonyCameraHolder, ISonyInterfaceProvi
4648 public void prepare()
4749 {
4850 Log.v(TAG, " prepare : " + sonyCamera.getFriendlyName() + " " + sonyCamera.getModelName());
49- ISonyCameraApi sonyCameraApi = SonyCameraApi.newInstance(sonyCamera);
50- eventObserver = CameraEventObserver.newInstance(context, sonyCameraApi);
51- liveViewControl = new SonyLiveViewControl(sonyCameraApi);
51+ try
52+ {
53+ ISonyCameraApi sonyCameraApi = SonyCameraApi.newInstance(sonyCamera);
54+ eventObserver = CameraEventObserver.newInstance(context, sonyCameraApi);
55+ liveViewControl = new SonyLiveViewControl(sonyCameraApi);
5256
53- focusControl.setCameraApi(sonyCameraApi);
54- captureControl.setCameraApi(sonyCameraApi);
57+ focusControl.setCameraApi(sonyCameraApi);
58+ captureControl.setCameraApi(sonyCameraApi);
59+ zoomControl.setCameraApi(sonyCameraApi);
60+ }
61+ catch (Exception e)
62+ {
63+ e.printStackTrace();
64+ }
5565 }
5666
5767 @Override
@@ -116,7 +126,7 @@ public class SonyCameraWrapper implements ISonyCameraHolder, ISonyInterfaceProvi
116126 @Override
117127 public IZoomLensControl getZoomLensControl()
118128 {
119- return null;
129+ return (zoomControl);
120130 }
121131
122132 @Override
@@ -138,5 +148,6 @@ public class SonyCameraWrapper implements ISonyCameraHolder, ISonyInterfaceProvi
138148
139149 focusControl = new SonyCameraFocusControl(frameDisplayer, indicator);
140150 captureControl = new SonyCameraCaptureControl(frameDisplayer, indicator);
151+ zoomControl = new SonyCameraZoomLensControl();
141152 }
142153 }
Afficher sur ancien navigateur de dépôt.