1 package net.osdn.gokigen.a01d.camera.nikon.operation;
3 import android.util.Log;
5 import androidx.annotation.NonNull;
7 import net.osdn.gokigen.a01d.camera.ICaptureControl;
8 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandCallback;
9 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.PtpIpCommandPublisher;
10 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.messages.PtpIpCommandGeneric;
11 import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
13 import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.REQUEST_SHUTTER_ON;
14 import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.SEQ_DEVICE_READY;
15 import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.SEQ_GET_EVENT;
17 public class NikonCaptureControl implements ICaptureControl, IPtpIpCommandCallback
19 private final String TAG = this.toString();
20 private final PtpIpCommandPublisher commandPublisher;
21 //private final IAutoFocusFrameDisplay frameDisplayer;
22 private boolean isDumpLog = true;
24 public NikonCaptureControl(@NonNull PtpIpCommandPublisher commandPublisher, IAutoFocusFrameDisplay frameDisplayer)
26 this.commandPublisher = commandPublisher;
27 //this.frameDisplayer = frameDisplayer;
31 public void doCapture(int kind)
36 Log.v(TAG, " doCapture() ");
39 commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, REQUEST_SHUTTER_ON, isDumpLog, 0, 0x9207, 8, 0xffffffff, 0x00));
40 commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_DEVICE_READY, isDumpLog, 0, 0x90c8));
41 commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_GET_EVENT, isDumpLog, 0, 0x90c7));
50 public void receivedMessage(int id, byte[] rx_body)
52 Log.v(TAG, " CanonCaptureControl::receivedMessage() : ");
55 if ((rx_body.length > 10)&&((rx_body[8] != (byte) 0x01)||(rx_body[9] != (byte) 0x20)))
57 Log.v(TAG, " --- RECEIVED NG REPLY. : " + id);
67 public void onReceiveProgress(int currentBytes, int totalBytes, byte[] rx_body)
69 Log.v(TAG, " CanonCaptureControl::onReceiveProgress() : " + currentBytes + "/" + totalBytes);
73 public boolean isReceiveMulti()