• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

OPC(Olympus Air)用望遠鏡アプリ。


Commit MetaInfo

Revisão2eb5dec7d293c16ef3919e55a7ce316af39a1499 (tree)
Hora2020-02-16 01:28:59
AutorMRSa <mrsa@myad...>
CommiterMRSa

Mensagem de Log

AF動作指示で応答を確認するよう変更する。ログ出力を調整する。

Mudança Sumário

Diff

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/canon/operation/CanonFocusingControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/canon/operation/CanonFocusingControl.java
@@ -11,8 +11,6 @@ import androidx.annotation.NonNull;
1111 import androidx.preference.PreferenceManager;
1212
1313 import net.osdn.gokigen.a01d.camera.IFocusingControl;
14-import net.osdn.gokigen.a01d.camera.fujix.wrapper.command.messages.FocusLock;
15-import net.osdn.gokigen.a01d.camera.fujix.wrapper.command.messages.FocusUnlock;
1614 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandCallback;
1715 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.PtpIpCommandPublisher;
1816 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.messages.PtpIpCommandGeneric;
@@ -20,8 +18,6 @@ import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
2018 import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
2119 import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
2220
23-import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.SEQ_GET_VIEWFRAME;
24-
2521 public class CanonFocusingControl implements IFocusingControl, IPtpIpCommandCallback
2622 {
2723 private final String TAG = this.toString();
@@ -39,6 +35,7 @@ public class CanonFocusingControl implements IFocusingControl, IPtpIpCommandCall
3935 private float maxPointLimitWidth;
4036 private float maxPointLimitHeight;
4137 private RectF preFocusFrameRect = null;
38+ private boolean isDumpLog = false;
4239
4340 public CanonFocusingControl(@NonNull Activity context, @NonNull PtpIpCommandPublisher commandPublisher, IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator)
4441 {
@@ -119,7 +116,7 @@ public class CanonFocusingControl implements IFocusingControl, IPtpIpCommandCall
119116 try
120117 {
121118 Log.v(TAG, " Unlock AF ");
122- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_UNLOCK, false, 0, 0x9160));
119+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_UNLOCK, isDumpLog, 0, 0x9160));
123120 }
124121 catch (Exception e)
125122 {
@@ -141,9 +138,9 @@ public class CanonFocusingControl implements IFocusingControl, IPtpIpCommandCall
141138 int x = (0x0000ffff & (Math.round(point.x * maxPointLimitWidth) + 1));
142139 int y = (0x0000ffff & (Math.round(point.y * maxPointLimitHeight) + 1));
143140 Log.v(TAG, "Lock AF: [" + x + ","+ y + "]");
144- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK_PRE, false, 0, 0x9160));
145- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK, 25, false, 0, 0x915b, 16, 0x03, x, y, 0x01));
146- commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_MOVE, false, 0, 0x9154));
141+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK_PRE, isDumpLog, 0, 0x9160));
142+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK, 25, isDumpLog, 0, 0x915b, 16, 0x03, x, y, 0x01));
143+ commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_MOVE, isDumpLog, 0, 0x9154));
147144 }
148145 catch (Exception e)
149146 {
@@ -201,6 +198,16 @@ public class CanonFocusingControl implements IFocusingControl, IPtpIpCommandCall
201198 {
202199 try
203200 {
201+
202+
203+ if ((rx_body.length > 10)&&((rx_body[8] != (byte) 0x01)||(rx_body[9] != (byte) 0x20)))
204+ {
205+ Log.v(TAG, " --- RECEIVED NG REPLY. : FOCUS OPERATION ---");
206+ hideFocusFrame();
207+ preFocusFrameRect = null;
208+ return;
209+ }
210+
204211 if ((id == FOCUS_LOCK)||(id == FOCUS_LOCK_PRE))
205212 {
206213 Log.v(TAG, "FOCUS LOCKED");
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/ptpip/wrapper/command/PtpIpCommandPublisher.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/ptpip/wrapper/command/PtpIpCommandPublisher.java
@@ -472,6 +472,14 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
472472 int target_length = parseDataLength(byte_array, read_bytes);
473473 int received_length = read_bytes;
474474
475+ if (target_length <= 0)
476+ {
477+ // 受信サイズ異常の場合...
478+ Log.v(TAG, " WRONG LENGTH. : " + target_length);
479+ callback.receivedMessage(id, null);
480+ return (false);
481+ }
482+
475483 // 一時的な処理
476484 if (callback != null)
477485 {
@@ -530,12 +538,10 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
530538 Log.v(TAG, " --- receive_multi : " + id + " (" + read_bytes + ") [" + maxRetryCount + "] " + receive_message_buffer_size + " (" + received_length + ") ");
531539 callback.receivedMessage(id, null);
532540 }
533- System.gc();
534541 }
535542 catch (Throwable e)
536543 {
537544 e.printStackTrace();
538- System.gc();
539545 }
540546 return (false);
541547 }
@@ -543,15 +549,15 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
543549 private int parseDataLength(byte[] byte_array, int read_bytes)
544550 {
545551 int lenlen = 0;
546- int packetType = 0;
552+ //int packetType = 0;
547553 try
548554 {
549555 if ((read_bytes > 20)&&((int) byte_array[4] == 0x09))
550556 {
551557 lenlen = ((((int) byte_array[15]) & 0xff) << 24) + ((((int) byte_array[14]) & 0xff) << 16) + ((((int) byte_array[13]) & 0xff) << 8) + (((int) byte_array[12]) & 0xff);
552- packetType = (((int)byte_array[16]) & 0xff);
558+ //packetType = (((int)byte_array[16]) & 0xff);
553559 }
554- Log.v(TAG, " --- parseDataLength() length: " + lenlen + " TYPE: " + packetType + " read_bytes: " + read_bytes);
560+ //Log.v(TAG, " --- parseDataLength() length: " + lenlen + " TYPE: " + packetType + " read_bytes: " + read_bytes);
555561 }
556562 catch (Exception e)
557563 {
Show on old repository browser