• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

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


Commit MetaInfo

Revisãofbc39f7e75101d9e6a73365124c68f0faf0e8dda (tree)
Hora2020-02-28 00:12:17
AutorMRSa <mrsa@myad...>
CommiterMRSa

Mensagem de Log

LiveViewを動かすところ。
AS3.6対応。

Mudança Sumário

Diff

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/operation/NikonFocusingControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/operation/NikonFocusingControl.java
@@ -34,7 +34,7 @@ public class NikonFocusingControl implements IFocusingControl, IPtpIpCommandCall
3434 private float maxPointLimitWidth;
3535 private float maxPointLimitHeight;
3636 private RectF preFocusFrameRect = null;
37- private boolean isDumpLog = false;
37+ private boolean isDumpLog = true;
3838
3939 public NikonFocusingControl(@NonNull Activity context, @NonNull PtpIpCommandPublisher commandPublisher, IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator)
4040 {
@@ -194,11 +194,17 @@ public class NikonFocusingControl implements IFocusingControl, IPtpIpCommandCall
194194 {
195195 try
196196 {
197-
198-
199- if ((rx_body.length > 10)&&((rx_body[8] != (byte) 0x01)||(rx_body[9] != (byte) 0x20)))
197+ if (rx_body.length < 10)
198+ {
199+ Log.v(TAG, " --- BODY LENGTH IS SHORT : FOCUS OPERATION ---");
200+ hideFocusFrame();
201+ preFocusFrameRect = null;
202+ return;
203+ }
204+ int responseCode = (rx_body[8] & 0xff) + ((rx_body[9] & 0xff) * 256);
205+ if (responseCode != 0x2001)
200206 {
201- Log.v(TAG, " --- RECEIVED NG REPLY. : FOCUS OPERATION ---");
207+ Log.v(TAG, String.format(" --- RECEIVED NG REPLY. : FOCUS OPERATION (0x%x) ---", responseCode));
202208 hideFocusFrame();
203209 preFocusFrameRect = null;
204210 return;
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/wrapper/liveview/NikonLiveViewControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/wrapper/liveview/NikonLiveViewControl.java
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
88 import net.osdn.gokigen.a01d.camera.ILiveViewControl;
99 import net.osdn.gokigen.a01d.camera.nikon.wrapper.command.messages.specific.NikonLiveViewRequestMessage;
1010 import net.osdn.gokigen.a01d.camera.ptpip.IPtpIpInterfaceProvider;
11+import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandCallback;
1112 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandPublisher;
1213 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommunication;
1314 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpResponseReceiver;
@@ -25,7 +26,7 @@ import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.
2526 import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.SEQ_START_LIVEVIEW;
2627 import static net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpMessages.SEQ_STOP_LIVEVIEW;
2728
28-public class NikonLiveViewControl implements ILiveViewControl, ILiveViewListener, IPtpIpCommunication, IPtpIpLiveViewImageCallback, IPtpIpResponseReceiver
29+public class NikonLiveViewControl implements ILiveViewControl, ILiveViewListener, IPtpIpCommunication, IPtpIpLiveViewImageCallback, IPtpIpCommandCallback
2930 {
3031 private final String TAG = this.toString();
3132 private final IPtpIpCommandPublisher commandIssuer;
@@ -60,9 +61,7 @@ public class NikonLiveViewControl implements ILiveViewControl, ILiveViewListene
6061 Log.v(TAG, " startLiveView() ");
6162 try
6263 {
63- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(new PtpIpResponseReceiver(null), SEQ_START_LIVEVIEW, 20, isDumpLog, 0, 0x9201, 0, 0x00, 0x00, 0x00, 0x00));
64- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(new PtpIpResponseReceiver(null), SEQ_DEVICE_READY, 20, isDumpLog, 0, 0x90c8, 0, 0x00, 0x00, 0x00, 0x00));
65- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(new PtpIpResponseReceiver(this), SEQ_AFDRIVE, 20, isDumpLog, 0, 0x90c1, 0, 0x00, 0x00, 0x00, 0x00));
64+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_START_LIVEVIEW, 20, isDumpLog, 0, 0x9201, 0, 0x00, 0x00, 0x00, 0x00));
6665 }
6766 catch (Exception e)
6867 {
@@ -208,16 +207,78 @@ public class NikonLiveViewControl implements ILiveViewControl, ILiveViewListene
208207 }
209208
210209 @Override
211- public void response(int id, int responseCode)
210+ public void receivedMessage(int id, byte[] rx_body)
212211 {
213- // 応答OKなら LV開始。
214- if ((id == SEQ_AFDRIVE)&&(responseCode == 0x2001))
212+ Log.v(TAG, " NikonLiveViewControl::receivedMessage() : ");
213+ try
214+ {
215+ if (rx_body.length < 10)
216+ {
217+ retrySendMessage(id);
218+ return;
219+ }
220+ int responseCode = (rx_body[8] & 0xff) + ((rx_body[9] & 0xff) * 256);
221+ if (responseCode != 0x2001)
222+ {
223+ // NG応答を受信...同じコマンドを再送する
224+ Log.v(TAG, String.format(" RECEIVED NG REPLY ID : %d, RESPONSE CODE : 0x%04x ", id, responseCode));
225+ retrySendMessage(id);
226+ return;
227+ }
228+
229+ Log.v(TAG, String.format(" OK REPLY (ID : %d) ", id));
230+ if (id == SEQ_START_LIVEVIEW)
231+ {
232+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_DEVICE_READY, 20, isDumpLog, 0, 0x90c8, 0, 0x00, 0x00, 0x00, 0x00));
233+ }
234+ else if (id == SEQ_DEVICE_READY)
235+ {
236+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_AFDRIVE, 20, isDumpLog, 0, 0x90c1, 0, 0x00, 0x00, 0x00, 0x00));
237+ }
238+ else
239+ {
240+ // ライブビューの開始。
241+ startLiveviewImpl();
242+ }
243+ }
244+ catch (Exception e)
245+ {
246+ e.printStackTrace();
247+ }
248+ }
249+
250+ private void retrySendMessage(int id)
251+ {
252+ try
215253 {
216- startLiveviewImpl();
254+ if (id == SEQ_START_LIVEVIEW)
255+ {
256+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_START_LIVEVIEW, 20, isDumpLog, 0, 0x9201, 0, 0x00, 0x00, 0x00, 0x00));
257+ }
258+ else if (id == SEQ_DEVICE_READY)
259+ {
260+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_DEVICE_READY, 20, isDumpLog, 0, 0x90c8, 0, 0x00, 0x00, 0x00, 0x00));
261+ }
262+ else
263+ {
264+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(this, SEQ_AFDRIVE, 20, isDumpLog, 0, 0x90c1, 0, 0x00, 0x00, 0x00, 0x00));
265+ }
217266 }
218- else
267+ catch (Exception e)
219268 {
220- Log.v(TAG, String.format(" ===== NikonLiveViewControl::response() ID : %d, RESPONSE CODE : 0x%04x ", id, responseCode));
269+ e.printStackTrace();
221270 }
222271 }
272+
273+ @Override
274+ public void onReceiveProgress(int currentBytes, int totalBytes, byte[] rx_body)
275+ {
276+ //
277+ }
278+
279+ @Override
280+ public boolean isReceiveMulti()
281+ {
282+ return (false);
283+ }
223284 }
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
66 google()
77 }
88 dependencies {
9- classpath 'com.android.tools.build:gradle:3.5.3'
9+ classpath 'com.android.tools.build:gradle:3.6.0'
1010
1111 // NOTE: Do not place your application dependencies here; they belong
1212 // in the individual module build.gradle files
--- a/gradle.properties
+++ b/gradle.properties
@@ -15,3 +15,6 @@ org.gradle.jvmargs=-Xmx1536m
1515 # This option should only be used with decoupled projects. More details, visit
1616 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1717 # org.gradle.parallel=true
18+
19+android.enableJetifier=true
20+android.useAndroidX=true
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
1-#Sat Sep 07 00:01:41 JST 2019
1+#Wed Feb 26 00:13:03 JST 2020
22 distributionBase=GRADLE_USER_HOME
33 distributionPath=wrapper/dists
44 zipStoreBase=GRADLE_USER_HOME
55 zipStorePath=wrapper/dists
6-distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
6+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Show on old repository browser