OPC(Olympus Air)用望遠鏡アプリ。
Revision | 2936174a5a5425bc215e413b5fa4a938c65ac23a (tree) |
---|---|
Zeit | 2018-07-07 01:13:03 |
Autor | MRSa <mrsa@myad...> |
Commiter | MRSa |
RICOH GR IIでのCROPモード切替に対応する。
@@ -5,12 +5,14 @@ import net.osdn.gokigen.a01d.camera.IZoomLensControl; | ||
5 | 5 | public class RicohGr2CameraZoomLensControl implements IZoomLensControl |
6 | 6 | { |
7 | 7 | @Override |
8 | - public boolean canZoom() { | |
9 | - return false; | |
8 | + public boolean canZoom() | |
9 | + { | |
10 | + return (false); | |
10 | 11 | } |
11 | 12 | |
12 | 13 | @Override |
13 | - public void updateStatus() { | |
14 | + public void updateStatus() | |
15 | + { | |
14 | 16 | |
15 | 17 | } |
16 | 18 |
@@ -30,22 +32,26 @@ public class RicohGr2CameraZoomLensControl implements IZoomLensControl | ||
30 | 32 | } |
31 | 33 | |
32 | 34 | @Override |
33 | - public void driveZoomLens(float targetLength) { | |
35 | + public void driveZoomLens(float targetLength) | |
36 | + { | |
34 | 37 | |
35 | 38 | } |
36 | 39 | |
37 | 40 | @Override |
38 | - public void driveZoomLens(boolean isZoomIn) { | |
41 | + public void driveZoomLens(boolean isZoomIn) | |
42 | + { | |
39 | 43 | |
40 | 44 | } |
41 | 45 | |
42 | 46 | @Override |
43 | - public void moveInitialZoomPosition() { | |
47 | + public void moveInitialZoomPosition() | |
48 | + { | |
44 | 49 | |
45 | 50 | } |
46 | 51 | |
47 | 52 | @Override |
48 | - public boolean isDrivingZoomLens() { | |
49 | - return false; | |
53 | + public boolean isDrivingZoomLens() | |
54 | + { | |
55 | + return (false); | |
50 | 56 | } |
51 | 57 | } |
@@ -4,6 +4,7 @@ import android.support.annotation.NonNull; | ||
4 | 4 | import android.util.Log; |
5 | 5 | |
6 | 6 | import net.osdn.gokigen.a01d.camera.ILiveViewControl; |
7 | +import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient; | |
7 | 8 | import net.osdn.gokigen.a01d.camera.utils.SimpleLiveviewSlicer; |
8 | 9 | import net.osdn.gokigen.a01d.liveview.liveviewlistener.CameraLiveViewListenerImpl; |
9 | 10 | import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener; |
@@ -17,6 +18,7 @@ public class RicohGr2LiveViewControl implements ILiveViewControl | ||
17 | 18 | private final String TAG = toString(); |
18 | 19 | private final CameraLiveViewListenerImpl liveViewListener; |
19 | 20 | private String liveViewUrl = "http://192.168.0.1/v1/display"; |
21 | + private float cropScale = 1.0f; | |
20 | 22 | private boolean whileFetching = false; |
21 | 23 | private static final int FETCH_ERROR_MAX = 30; |
22 | 24 |
@@ -171,22 +173,102 @@ public class RicohGr2LiveViewControl implements ILiveViewControl | ||
171 | 173 | |
172 | 174 | } |
173 | 175 | |
176 | + /** | |
177 | + * デジタルズーム倍率の設定値を応答する | |
178 | + * | |
179 | + */ | |
174 | 180 | @Override |
175 | - public void updateMagnifyingLiveViewScale(boolean isChangeScale) | |
181 | + public float getDigitalZoomScale() | |
176 | 182 | { |
177 | - | |
183 | + return (1.0f); | |
178 | 184 | } |
179 | 185 | |
186 | + /** | |
187 | + * クロップサイズを変更する | |
188 | + * | |
189 | + */ | |
180 | 190 | @Override |
181 | - public float getMagnifyingLiveViewScale() | |
191 | + public void updateMagnifyingLiveViewScale(final boolean isChangeScale) | |
182 | 192 | { |
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 | + } | |
184 | 262 | } |
185 | 263 | |
264 | + /** | |
265 | + * ライブビュー拡大倍率の設定値を応答する | |
266 | + * | |
267 | + */ | |
186 | 268 | @Override |
187 | - public float getDigitalZoomScale() | |
269 | + public float getMagnifyingLiveViewScale() | |
188 | 270 | { |
189 | - return (1.0f); | |
271 | + return (cropScale); | |
190 | 272 | } |
191 | 273 | |
192 | 274 | public ILiveViewListener getLiveViewListener() |
@@ -298,8 +298,12 @@ public class SonyCameraApiListFragment extends ListFragment implements SendReque | ||
298 | 298 | /** |
299 | 299 | * API のコマンドを発行する。 |
300 | 300 | * |
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) | |
303 | 307 | */ |
304 | 308 | @Override |
305 | 309 | 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 | ||
463 | 467 | catch (Exception e) |
464 | 468 | { |
465 | 469 | 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); | |
467 | 480 | e.printStackTrace(); |
468 | 481 | } |
469 | 482 | } |
@@ -155,7 +155,9 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo | ||
155 | 155 | manualFocus = view.findViewById(R.id.focusing_button); |
156 | 156 | changeLiveViewScale = view.findViewById(R.id.live_view_scale_button); |
157 | 157 | |
158 | - if (interfaceProvider.getCammeraConnectionMethod() == ICameraConnection.CameraConnectionMethod.OPC) | |
158 | + ICameraConnection.CameraConnectionMethod connectionMethod = interfaceProvider.getCammeraConnectionMethod(); | |
159 | + | |
160 | + if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC) | |
159 | 161 | { |
160 | 162 | view.findViewById(R.id.show_favorite_settings_button).setOnClickListener(onClickTouchListener); |
161 | 163 | } |
@@ -176,14 +178,24 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo | ||
176 | 178 | { |
177 | 179 | manualFocus.setVisibility(View.INVISIBLE); |
178 | 180 | } |
179 | - if (changeLiveViewScale != null) | |
180 | - { | |
181 | - changeLiveViewScale.setVisibility(View.INVISIBLE); | |
182 | - } | |
183 | 181 | propertyButton.setVisibility(View.INVISIBLE); |
184 | 182 | } |
185 | 183 | }); |
186 | 184 | } |
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 | + } | |
187 | 199 | } |
188 | 200 | |
189 | 201 | if (manualFocus != null) |