OSDN Git Service

Pentax DSLR機で、AFを動作後シャッターを切る設定ができるよう変更する。(でも、再起動必要...)
[gokigen/Gr2Control.git] / app / src / main / java / net / osdn / gokigen / gr2control / camera / ricohgr2 / operation / RicohGr2CameraCaptureControl.java
1 package net.osdn.gokigen.gr2control.camera.ricohgr2.operation;
2
3 import android.support.annotation.NonNull;
4
5 import net.osdn.gokigen.gr2control.camera.ICameraStatus;
6 import net.osdn.gokigen.gr2control.camera.ICaptureControl;
7 import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.takepicture.RicohGr2MovieShotControl;
8 import net.osdn.gokigen.gr2control.camera.ricohgr2.operation.takepicture.RicohGr2SingleShotControl;
9 import net.osdn.gokigen.gr2control.liveview.IAutoFocusFrameDisplay;
10
11 /**
12  *
13  *
14  */
15 public class RicohGr2CameraCaptureControl implements ICaptureControl
16 {
17     private final RicohGr2SingleShotControl singleShotControl;
18     private final RicohGr2MovieShotControl movieShotControl;
19     private final ICameraStatus cameraStatus;
20     private final boolean useGrCommand;
21     private final boolean captureAfterAf;
22
23     /**
24      *
25      *
26      */
27     public RicohGr2CameraCaptureControl(boolean useGrCommand, boolean captureAfterAf, @NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull ICameraStatus cameraStatus)
28     {
29         this.useGrCommand = useGrCommand;
30         this.captureAfterAf = captureAfterAf;
31         this.cameraStatus = cameraStatus;
32         singleShotControl = new RicohGr2SingleShotControl(frameDisplayer);
33         movieShotControl = new RicohGr2MovieShotControl(frameDisplayer);
34     }
35
36     /**
37      *
38      *
39      */
40     @Override
41     public void doCapture(int kind)
42     {
43         try
44         {
45             if (cameraStatus.getStatus(ICameraStatus.TAKE_MODE).contains(ICameraStatus.TAKE_MODE_MOVIE))
46             {
47                 movieShotControl.toggleMovie();
48             }
49             else
50             {
51                 singleShotControl.singleShot(useGrCommand, captureAfterAf);
52             }
53         }
54         catch (Exception e)
55         {
56             e.printStackTrace();
57         }
58     }
59 }