• R/O
  • HTTP
  • SSH
  • HTTPS

A01d: Commit

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


Commit MetaInfo

Revisãoff202a61fe5c54a3575daa109d68a7f7867690af (tree)
Hora2020-02-24 00:29:28
AutorMRSa <mrsa@myad...>
CommiterMRSa

Mensagem de Log

NIKON対応ひととおり。

Mudança Sumário

Diff

--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/operation/NikonCaptureControl.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/operation/NikonCaptureControl.java
@@ -49,12 +49,17 @@ public class NikonCaptureControl implements ICaptureControl, IPtpIpCommandCallba
4949 @Override
5050 public void receivedMessage(int id, byte[] rx_body)
5151 {
52- Log.v(TAG, " CanonCaptureControl::receivedMessage() : ");
52+ Log.v(TAG, " NikonCaptureControl::receivedMessage() : ");
5353 try
5454 {
55- if ((rx_body.length > 10)&&((rx_body[8] != (byte) 0x01)||(rx_body[9] != (byte) 0x20)))
55+ int responseCode = (rx_body[8] & 0xff) + ((rx_body[9] & 0xff) * 256);
56+ if ((rx_body.length > 10) && (responseCode != 0x2001))
5657 {
57- Log.v(TAG, " --- RECEIVED NG REPLY. : " + id);
58+ Log.v(TAG, String.format(" RECEIVED NG REPLY ID : %d, RESPONSE CODE : 0x%04x ", id, responseCode));
59+ }
60+ else
61+ {
62+ Log.v(TAG, String.format(" OK REPLY (ID : %d) ", id));
5863 }
5964 }
6065 catch (Exception e)
@@ -66,7 +71,7 @@ public class NikonCaptureControl implements ICaptureControl, IPtpIpCommandCallba
6671 @Override
6772 public void onReceiveProgress(int currentBytes, int totalBytes, byte[] rx_body)
6873 {
69- Log.v(TAG, " CanonCaptureControl::onReceiveProgress() : " + currentBytes + "/" + totalBytes);
74+ Log.v(TAG, " NikonCaptureControl::onReceiveProgress() : " + currentBytes + "/" + totalBytes);
7075 }
7176
7277 @Override
--- 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
@@ -45,7 +45,7 @@ public class NikonFocusingControl implements IFocusingControl, IPtpIpCommandCall
4545 try
4646 {
4747 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
48- String focusPoint = preferences.getString(IPreferencePropertyAccessor.CANON_FOCUS_XY, IPreferencePropertyAccessor.CANON_FOCUS_XY_DEFAULT_VALUE);
48+ String focusPoint = preferences.getString(IPreferencePropertyAccessor.NIKON_FOCUS_XY, IPreferencePropertyAccessor.NIKON_FOCUS_XY_DEFAULT_VALUE);
4949 String[] focus = focusPoint.split(",");
5050 if (focus.length == 2)
5151 {
@@ -70,11 +70,11 @@ public class NikonFocusingControl implements IFocusingControl, IPtpIpCommandCall
7070 @Override
7171 public boolean driveAutoFocus(final MotionEvent motionEvent)
7272 {
73- Log.v(TAG, "driveAutoFocus()");
7473 if (motionEvent.getAction() != MotionEvent.ACTION_DOWN)
7574 {
7675 return (false);
7776 }
77+ Log.v(TAG, "driveAutoFocus()");
7878 Thread thread = new Thread(new Runnable() {
7979 @Override
8080 public void run() {
--- 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
@@ -79,7 +79,7 @@ public class NikonLiveViewControl implements ILiveViewControl, ILiveViewListene
7979 if (liveViewIsReceiving)
8080 {
8181 liveViewIsReceiving = false;
82- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(new PtpIpResponseReceiver(null), SEQ_STOP_LIVEVIEW, 20, isDumpLog, 0, 0x9202, 0, 0x00, 0x00, 0x00, 0x00));
82+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(new PtpIpResponseReceiver(null), SEQ_STOP_LIVEVIEW, 30, isDumpLog, 0, 0x9202, 0, 0x00, 0x00, 0x00, 0x00));
8383 }
8484 }
8585 catch (Exception e)
@@ -104,7 +104,7 @@ public class NikonLiveViewControl implements ILiveViewControl, ILiveViewListene
104104 if (!commandIssued)
105105 {
106106 commandIssued = true;
107- commandIssuer.enqueueCommand(new PtpIpCommandGeneric(imageReceiver, SEQ_GET_VIEWFRAME, 40, true, 0, 0x9203, 0, 0x00, 0x00, 0x00, 0x00));
107+ commandIssuer.enqueueCommand(new PtpIpCommandGeneric(imageReceiver, SEQ_GET_VIEWFRAME, 80, true, 0, 0x9203, 0, 0x00, 0x00, 0x00, 0x00));
108108 }
109109 try
110110 {
--- a/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/wrapper/liveview/NikonLiveViewImageReceiver.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/camera/nikon/wrapper/liveview/NikonLiveViewImageReceiver.java
@@ -5,10 +5,8 @@ import android.util.Log;
55 import androidx.annotation.NonNull;
66 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandCallback;
77 import net.osdn.gokigen.a01d.camera.ptpip.wrapper.liveview.IPtpIpLiveViewImageCallback;
8-import net.osdn.gokigen.a01d.camera.utils.SimpleLogDumper;
98
109 import java.io.ByteArrayOutputStream;
11-import java.util.Arrays;
1210
1311 public class NikonLiveViewImageReceiver implements IPtpIpCommandCallback
1412 {
@@ -60,7 +58,7 @@ public class NikonLiveViewImageReceiver implements IPtpIpCommandCallback
6058 @Override
6159 public void onReceiveProgress(final int currentBytes, final int totalBytes, byte[] rx_body)
6260 {
63- Log.v(TAG, " onReceiveProgress() " + currentBytes + "/" + totalBytes);
61+ //Log.v(TAG, " onReceiveProgress() " + currentBytes + "/" + totalBytes);
6462
6563 // 受信したデータから、通信のヘッダ部分を削除する
6664 cutHeader(rx_body);
@@ -72,7 +70,6 @@ public class NikonLiveViewImageReceiver implements IPtpIpCommandCallback
7270 {
7371 return;
7472 }
75- int first_offset = 416;
7673 int length = rx_body.length;
7774 int data_position = 0;
7875 if (!receivedFirstData)
@@ -80,7 +77,7 @@ public class NikonLiveViewImageReceiver implements IPtpIpCommandCallback
8077 // データを最初に読んだとき。ヘッダ部分を読み飛ばす
8178 receivedFirstData = true;
8279 data_position = (int) rx_body[0] & (0xff);
83- Log.v(TAG, " FIRST DATA POS. : " + data_position);
80+ //Log.v(TAG, " FIRST DATA POS. : " + data_position);
8481 //SimpleLogDumper.dump_bytes(" [sssXXXsss]", Arrays.copyOfRange(rx_body, first_offset, (first_offset + 64)));
8582 }
8683 else if (received_remain_bytes > 0)
@@ -113,30 +110,8 @@ public class NikonLiveViewImageReceiver implements IPtpIpCommandCallback
113110 break;
114111 }
115112
116- int forward_length = data_position;
117-
118113 // 受信データ(のヘッダ部分)をダンプする
119- Log.v(TAG, " RX DATA : " + data_position + " (" + body_size + ") [" + received_remain_bytes + "] (" + received_total_bytes + ")");
120- try
121- {
122- while (forward_length < rx_body.length)
123- {
124-
125- if ((rx_body[forward_length] == (byte) 0xff)&&(rx_body[forward_length + 1] == (byte) 0xd8))
126- {
127- break;
128- }
129- forward_length++;
130- }
131- if (forward_length >= rx_body.length)
132- {
133- forward_length = data_position + 12;
134- }
135- }
136- catch (Exception e)
137- {
138- e.printStackTrace();
139- }
114+ //Log.v(TAG, " RX DATA : " + data_position + " (" + body_size + ") [" + received_remain_bytes + "] (" + received_total_bytes + ")");
140115
141116 if ((data_position + body_size) > length)
142117 {
@@ -145,7 +120,7 @@ public class NikonLiveViewImageReceiver implements IPtpIpCommandCallback
145120 byteStream.write(rx_body, (data_position + (12)), copysize);
146121 received_remain_bytes = body_size - copysize - (12); // マイナス12は、ヘッダ分
147122 received_total_bytes = received_total_bytes + copysize;
148- Log.v(TAG, " ----- copy : " + (data_position + (12)) + " " + copysize + " remain : " + received_remain_bytes + " body size : " + body_size);
123+ //Log.v(TAG, " ----- copy : " + (data_position + (12)) + " " + copysize + " remain : " + received_remain_bytes + " body size : " + body_size);
149124 break;
150125 }
151126 try
@@ -153,7 +128,7 @@ public class NikonLiveViewImageReceiver implements IPtpIpCommandCallback
153128 byteStream.write(rx_body, (data_position + (12)), (body_size - (12)));
154129 data_position = data_position + body_size;
155130 received_total_bytes = received_total_bytes + (12);
156- Log.v(TAG, " --- COPY : " + (data_position + 12) + " " + (body_size - (12)) + " remain : " + received_remain_bytes);
131+ //Log.v(TAG, " --- COPY : " + (data_position + 12) + " " + (body_size - (12)) + " remain : " + received_remain_bytes);
157132 }
158133 catch (Exception e)
159134 {
--- 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
@@ -466,7 +466,11 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
466466 {
467467 // リトライオーバー...
468468 Log.v(TAG, " RECEIVE : RETRY OVER......");
469- return (true);
469+ if (command.isRetrySend())
470+ {
471+ // 要求を再送する場合、、、ダメな場合は受信待ちとする
472+ return (true);
473+ }
470474 }
471475
472476 // 初回データの読み込み
@@ -635,7 +639,7 @@ public class PtpIpCommandPublisher implements IPtpIpCommandPublisher, IPtpIpComm
635639 {
636640 if (isLogOutput)
637641 {
638- Log.v(TAG, " is.available() WAIT... ");
642+ Log.v(TAG, "waitForReceive:: is.available() WAIT... : " + delayMs + "ms");
639643 isLogOutput = false;
640644 }
641645 retry_count--;
--- a/app/src/main/java/net/osdn/gokigen/a01d/preference/IPreferencePropertyAccessor.java
+++ b/app/src/main/java/net/osdn/gokigen/a01d/preference/IPreferencePropertyAccessor.java
@@ -76,7 +76,10 @@ public interface IPreferencePropertyAccessor
7676 String CANON_ZOOM_RESOLUTION = "canon_zoom_resolution";
7777 String CANON_ZOOM_RESOLUTION_DEFAULT_VALUE = "25";
7878
79- /*
79+ String NIKON_FOCUS_XY = "nikon_focus_xy";
80+ String NIKON_FOCUS_XY_DEFAULT_VALUE = "6000,4000";
81+
82+ /*
8083 int CHOICE_SPLASH_SCREEN = 10;
8184
8285 int SELECT_SAMPLE_IMAGE_CODE = 110;
@@ -91,6 +94,6 @@ public interface IPreferencePropertyAccessor
9194 void stored(boolean result);
9295 void restored(boolean result);
9396 }
94-*****/
97+*/
9598
9699 }
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -39,6 +39,8 @@
3939 <string name="pref_summary_fujix_focus_xy">フォーカス点数を指定します</string>
4040 <string name="pref_canon_focus_xy">フォーカス点数 (default: 6000,4000)</string>
4141 <string name="pref_summary_canon_focus_xy">フォーカス点数を指定します</string>
42+ <string name="pref_nikon_focus_xy">フォーカス点数 (default: 6000,4000)</string>
43+ <string name="pref_summary_nikon_focus_xy">フォーカス点数を指定します</string>
4244 <string name="pref_fujix_liveview_wait">LV画像受信待ち間隔(default: 80)</string>
4345 <string name="pref_summary_fujix_liveview_wait">ライブビュー画像受信間隔を指定します</string>
4446 <string name="pref_fujix_command_polling_wait">コマンド間隔(default: 500)</string>
@@ -176,7 +178,6 @@
176178 <string name="pref_use_pentax_autofocus">PENTAX一眼カメラの制御</string>
177179 <string name="pref_use_pentax_autofocus_summary">PENTAX一眼カメラ用の命令を使って制御します。</string>
178180
179-
180181 <string name="dialog_http_command_title_command">HTTPメッセージ送信</string>
181182 <string name="dialog_ricoh_command_title_command">メッセージ送信(RICOH)</string>
182183 <string name="dialog_panasonic_command_title_command">メッセージ送信(Panasonic)</string>
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -40,6 +40,8 @@
4040 <string name="pref_summary_fujix_focus_xy"> </string>
4141 <string name="pref_canon_focus_xy">Number of Focus Point X,Y (default: 6000,4000)</string>
4242 <string name="pref_summary_canon_focus_xy"> </string>
43+ <string name="pref_nikon_focus_xy">Number of Focus Point X,Y (default: 6000,4000)</string>
44+ <string name="pref_summary_nikon_focus_xy"> </string>
4345 <string name="pref_fujix_liveview_wait">Liveview receive wait (default: 80)</string>
4446 <string name="pref_summary_fujix_liveview_wait"> </string>
4547 <string name="pref_fujix_command_polling_wait">Status polling wait (default: 500)</string>
--- a/app/src/main/res/xml/preferences_nikon.xml
+++ b/app/src/main/res/xml/preferences_nikon.xml
@@ -25,6 +25,12 @@
2525 <PreferenceCategory
2626 android:title="@string/pref_cat_camera">
2727
28+ <EditTextPreference
29+ android:key="nikon_focus_xy"
30+ android:title="@string/pref_nikon_focus_xy"
31+ android:defaultValue="6000,4000"
32+ android:summary="@string/pref_summary_nikon_focus_xy" />
33+
2834 <CheckBoxPreference
2935 android:key="capture_both_camera_and_live_view"
3036 android:title="@string/pref_capture_both_camera_and_live_view" />
Show on old repository browser