• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

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


Commit MetaInfo

Révision2936174a5a5425bc215e413b5fa4a938c65ac23a (tree)
l'heure2018-07-07 01:13:03
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

RICOH GR IIでのCROPモード切替に対応する。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/RicohGr2CameraZoomLensControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/operation/RicohGr2CameraZoomLensControl.java
@@ -5,12 +5,14 @@ import net.osdn.gokigen.a01d.camera.IZoomLensControl;
55 public class RicohGr2CameraZoomLensControl implements IZoomLensControl
66 {
77 @Override
8- public boolean canZoom() {
9- return false;
8+ public boolean canZoom()
9+ {
10+ return (false);
1011 }
1112
1213 @Override
13- public void updateStatus() {
14+ public void updateStatus()
15+ {
1416
1517 }
1618
@@ -30,22 +32,26 @@ public class RicohGr2CameraZoomLensControl implements IZoomLensControl
3032 }
3133
3234 @Override
33- public void driveZoomLens(float targetLength) {
35+ public void driveZoomLens(float targetLength)
36+ {
3437
3538 }
3639
3740 @Override
38- public void driveZoomLens(boolean isZoomIn) {
41+ public void driveZoomLens(boolean isZoomIn)
42+ {
3943
4044 }
4145
4246 @Override
43- public void moveInitialZoomPosition() {
47+ public void moveInitialZoomPosition()
48+ {
4449
4550 }
4651
4752 @Override
48- public boolean isDrivingZoomLens() {
49- return false;
53+ public boolean isDrivingZoomLens()
54+ {
55+ return (false);
5056 }
5157 }
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/wrapper/RicohGr2LiveViewControl.java
@@ -4,6 +4,7 @@ import android.support.annotation.NonNull;
44 import android.util.Log;
55
66 import net.osdn.gokigen.a01d.camera.ILiveViewControl;
7+import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
78 import net.osdn.gokigen.a01d.camera.utils.SimpleLiveviewSlicer;
89 import net.osdn.gokigen.a01d.liveview.liveviewlistener.CameraLiveViewListenerImpl;
910 import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener;
@@ -17,6 +18,7 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
1718 private final String TAG = toString();
1819 private final CameraLiveViewListenerImpl liveViewListener;
1920 private String liveViewUrl = "http://192.168.0.1/v1/display";
21+ private float cropScale = 1.0f;
2022 private boolean whileFetching = false;
2123 private static final int FETCH_ERROR_MAX = 30;
2224
@@ -171,22 +173,102 @@ public class RicohGr2LiveViewControl implements ILiveViewControl
171173
172174 }
173175
176+ /**
177+ * デジタルズーム倍率の設定値を応答する
178+ *
179+ */
174180 @Override
175- public void updateMagnifyingLiveViewScale(boolean isChangeScale)
181+ public float getDigitalZoomScale()
176182 {
177-
183+ return (1.0f);
178184 }
179185
186+ /**
187+ * クロップサイズを変更する
188+ *
189+ */
180190 @Override
181- public float getMagnifyingLiveViewScale()
191+ public void updateMagnifyingLiveViewScale(final boolean isChangeScale)
182192 {
183- return (1.0f);
193+ //
194+ try
195+ {
196+ if (isChangeScale)
197+ {
198+ if (cropScale == 1.0f)
199+ {
200+ cropScale = 1.25f;
201+ }
202+ else if (cropScale == 1.25f)
203+ {
204+ cropScale = 1.68f;
205+ }
206+ else
207+ {
208+ cropScale = 1.0f;
209+ }
210+ }
211+ Thread thread = new Thread(new Runnable()
212+ {
213+ @Override
214+ public void run()
215+ {
216+ try
217+ {
218+ String cropSize = "CROP_SIZE_ORIGINAL";
219+ int timeoutMs = 5000;
220+ String grCmdUrl = "http://192.168.0.1/_gr";
221+ String postData;
222+ String result;
223+ if (isChangeScale)
224+ {
225+ postData = "mpget=CROP_SHOOTING";
226+ result = SimpleHttpClient.httpPost(grCmdUrl, postData, timeoutMs);
227+ if ((result == null) || (result.length() < 1))
228+ {
229+ Log.v(TAG, "reply is null.");
230+ cropScale = 1.0f;
231+ } else if (result.contains("SIZE_M")) {
232+ cropSize = "CROP_SIZE_S";
233+ cropScale = 1.68f;
234+ } else if (result.contains("SIZE_S")) {
235+ cropSize = "CROP_SIZE_ORIGINAL";
236+ cropScale = 1.0f;
237+ } else {
238+ cropSize = "CROP_SIZE_M";
239+ cropScale = 1.25f;
240+ }
241+ }
242+ postData = "mpset=CROP_SHOOTING " + cropSize;
243+ result = SimpleHttpClient.httpPost(grCmdUrl, postData, timeoutMs);
244+ Log.v(TAG, "RESULT1 : " + result);
245+
246+ postData = "cmd=mode refresh";
247+ result = SimpleHttpClient.httpPost(grCmdUrl, postData, timeoutMs);
248+ Log.v(TAG, "RESULT2 : " + result);
249+ }
250+ catch (Exception e)
251+ {
252+ e.printStackTrace();
253+ }
254+ }
255+ });
256+ thread.start();
257+ }
258+ catch (Exception e)
259+ {
260+ e.printStackTrace();
261+ }
184262 }
185263
264+ /**
265+ * ライブビュー拡大倍率の設定値を応答する
266+ *
267+ */
186268 @Override
187- public float getDigitalZoomScale()
269+ public float getMagnifyingLiveViewScale()
188270 {
189- return (1.0f);
271+ return (cropScale);
190272 }
191273
192274 public ILiveViewListener getLiveViewListener()
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/cameraproperty/SonyCameraApiListFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/sony/cameraproperty/SonyCameraApiListFragment.java
@@ -298,8 +298,12 @@ public class SonyCameraApiListFragment extends ListFragment implements SendReque
298298 /**
299299 * API のコマンドを発行する。
300300 *
301- * ※ 注意:パラメータはカンマ区切りで複数個を入力してもらう予定
302- *
301+ * ※ 注意: 引数パラメータはカンマ区切りで複数個を入力してもらう
302+ * key & Value 値 keyとvalueのあいだを : で区切る (key:value みたいな感じ)
303+ * $T Boolean値の True
304+ * $F Boolean値の False
305+ * #xx 数値(integer)
306+ * #xx.xx 数値(double)
303307 */
304308 @Override
305309 public void sendRequest(final String service, final String apiName, final String parameter, final String version)
@@ -463,7 +467,16 @@ public class SonyCameraApiListFragment extends ListFragment implements SendReque
463467 catch (Exception e)
464468 {
465469 ConfirmationDialog dialog = ConfirmationDialog.newInstance(getActivity());
466- dialog.show(android.R.drawable.ic_dialog_alert, getString(R.string.dialog_title_reply), "RECEIVE ERROR");
470+ String replyString = "";
471+ try
472+ {
473+ replyString = reply.toString(4);
474+ }
475+ catch (Exception ee)
476+ {
477+ ee.printStackTrace();
478+ }
479+ dialog.show(android.R.drawable.ic_dialog_alert, getString(R.string.dialog_title_reply), "RECEIVE ERROR \r\n" + replyString);
467480 e.printStackTrace();
468481 }
469482 }
--- a/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java
@@ -155,7 +155,9 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
155155 manualFocus = view.findViewById(R.id.focusing_button);
156156 changeLiveViewScale = view.findViewById(R.id.live_view_scale_button);
157157
158- if (interfaceProvider.getCammeraConnectionMethod() == ICameraConnection.CameraConnectionMethod.OPC)
158+ ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod();
159+
160+ if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
159161 {
160162 view.findViewById(R.id.show_favorite_settings_button).setOnClickListener(onClickTouchListener);
161163 }
@@ -176,14 +178,24 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
176178 {
177179 manualFocus.setVisibility(View.INVISIBLE);
178180 }
179- if (changeLiveViewScale != null)
180- {
181- changeLiveViewScale.setVisibility(View.INVISIBLE);
182- }
183181 propertyButton.setVisibility(View.INVISIBLE);
184182 }
185183 });
186184 }
185+ if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
186+ {
187+ if (changeLiveViewScale != null)
188+ {
189+ changeLiveViewScale.setVisibility(View.INVISIBLE);
190+ }
191+ }
192+ else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
193+ {
194+ if (changeLiveViewScale != null)
195+ {
196+ changeLiveViewScale.setVisibility(View.VISIBLE);
197+ }
198+ }
187199 }
188200
189201 if (manualFocus != null)
Afficher sur ancien navigateur de dépôt.