OSDN Git Service

FujiXのJPEGダウンロード機能を追加。
[gokigen/PKRemote.git] / app / src / main / java / net / osdn / gokigen / pkremote / camera / vendor / fujix / operation / FujiXCaptureControl.java
1 package net.osdn.gokigen.pkremote.camera.vendor.fujix.operation;
2
3
4 import android.util.Log;
5
6 import androidx.annotation.NonNull;
7
8 import net.osdn.gokigen.pkremote.camera.interfaces.control.ICaptureControl;
9 import net.osdn.gokigen.pkremote.camera.interfaces.liveview.IAutoFocusFrameDisplay;
10 import net.osdn.gokigen.pkremote.camera.vendor.fujix.wrapper.command.IFujiXCommandCallback;
11 import net.osdn.gokigen.pkremote.camera.vendor.fujix.wrapper.command.IFujiXCommandPublisher;
12 import net.osdn.gokigen.pkremote.camera.vendor.fujix.wrapper.command.messages.CaptureCommand;
13
14 public class FujiXCaptureControl implements ICaptureControl, IFujiXCommandCallback
15 {
16     private final String TAG = this.toString();
17     private final IFujiXCommandPublisher issuer;
18     private final IAutoFocusFrameDisplay frameDisplay;
19
20
21     public FujiXCaptureControl(@NonNull IFujiXCommandPublisher issuer, IAutoFocusFrameDisplay frameDisplay)
22     {
23         this.issuer = issuer;
24         this.frameDisplay = frameDisplay;
25
26     }
27
28     @Override
29     public void doCapture(int kind)
30     {
31         try
32         {
33             boolean ret = issuer.enqueueCommand(new CaptureCommand(this));
34             if (!ret)
35             {
36                 Log.v(TAG, "enqueue ERROR");
37             }
38         }
39         catch (Exception e)
40         {
41             e.printStackTrace();
42         }
43     }
44
45     @Override
46     public void receivedMessage(int id, byte[] rx_body)
47     {
48         Log.v(TAG, "Response Received.");
49         frameDisplay.hideFocusFrame();
50     }
51
52     @Override
53     public void onReceiveProgress(int currentBytes, int totalBytes, byte[] body)
54     {
55         Log.v(TAG, " " + currentBytes + "/" + totalBytes);
56     }
57
58     @Override
59     public boolean isReceiveMulti()
60     {
61         return (false);
62     }
63 }