import androidx.preference.PreferenceManager;
import net.osdn.gokigen.a01d.camera.IFocusingControl;
-import net.osdn.gokigen.a01d.camera.fujix.wrapper.command.messages.FocusLock;
-import net.osdn.gokigen.a01d.camera.fujix.wrapper.command.messages.FocusUnlock;
import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandCallback;
import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.PtpIpCommandPublisher;
import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.messages.PtpIpCommandGeneric;
import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
-import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.SEQ_GET_VIEWFRAME;
-
public class CanonFocusingControl implements IFocusingControl, IPtpIpCommandCallback
{
private final String TAG = this.toString();
private float maxPointLimitWidth;
private float maxPointLimitHeight;
private RectF preFocusFrameRect = null;
+ private boolean isDumpLog = false;
public CanonFocusingControl(@NonNull Activity context, @NonNull PtpIpCommandPublisher commandPublisher, IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator)
{
try
{
Log.v(TAG, " Unlock AF ");
- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_UNLOCK, false, 0, 0x9160));
+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_UNLOCK, isDumpLog, 0, 0x9160));
}
catch (Exception e)
{
int x = (0x0000ffff & (Math.round(point.x * maxPointLimitWidth) + 1));
int y = (0x0000ffff & (Math.round(point.y * maxPointLimitHeight) + 1));
Log.v(TAG, "Lock AF: [" + x + ","+ y + "]");
- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK_PRE, false, 0, 0x9160));
- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK, 25, false, 0, 0x915b, 16, 0x03, x, y, 0x01));
- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_MOVE, false, 0, 0x9154));
+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK_PRE, isDumpLog, 0, 0x9160));
+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK, 25, isDumpLog, 0, 0x915b, 16, 0x03, x, y, 0x01));
+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_MOVE, isDumpLog, 0, 0x9154));
}
catch (Exception e)
{
{
try
{
+
+
+ if ((rx_body.length > 10)&&((rx_body[8] != (byte) 0x01)||(rx_body[9] != (byte) 0x20)))
+ {
+ Log.v(TAG, " --- RECEIVED NG REPLY. : FOCUS OPERATION ---");
+ hideFocusFrame();
+ preFocusFrameRect = null;
+ return;
+ }
+
if ((id == FOCUS_LOCK)||(id == FOCUS_LOCK_PRE))
{
Log.v(TAG, "FOCUS LOCKED");
int target_length = parseDataLength(byte_array, read_bytes);
int received_length = read_bytes;
+ if (target_length <= 0)
+ {
+ // 受信サイズ異常の場合...
+ Log.v(TAG, " WRONG LENGTH. : " + target_length);
+ callback.receivedMessage(id, null);
+ return (false);
+ }
+
// 一時的な処理
if (callback != null)
{
Log.v(TAG, " --- receive_multi : " + id + " (" + read_bytes + ") [" + maxRetryCount + "] " + receive_message_buffer_size + " (" + received_length + ") ");
callback.receivedMessage(id, null);
}
- System.gc();
}
catch (Throwable e)
{
e.printStackTrace();
- System.gc();
}
return (false);
}
private int parseDataLength(byte[] byte_array, int read_bytes)
{
int lenlen = 0;
- int packetType = 0;
+ //int packetType = 0;
try
{
if ((read_bytes > 20)&&((int) byte_array[4] == 0x09))
{
lenlen = ((((int) byte_array[15]) & 0xff) << 24) + ((((int) byte_array[14]) & 0xff) << 16) + ((((int) byte_array[13]) & 0xff) << 8) + (((int) byte_array[12]) & 0xff);
- packetType = (((int)byte_array[16]) & 0xff);
+ //packetType = (((int)byte_array[16]) & 0xff);
}
- Log.v(TAG, " --- parseDataLength() length: " + lenlen + " TYPE: " + packetType + " read_bytes: " + read_bytes);
+ //Log.v(TAG, " --- parseDataLength() length: " + lenlen + " TYPE: " + packetType + " read_bytes: " + read_bytes);
}
catch (Exception e)
{