• R/O
  • HTTP
  • SSH
  • HTTPS

PKRemote: Commit

Pentax DSLR Remote Control app.


Commit MetaInfo

Révision95b907aa6cab7c9e8e8036c7b6ddd855e115cd1c (tree)
l'heure2020-12-30 23:17:48
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

とりあえず、Power Shot Zoomから画像をダウンロードできるところまで。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/PtpIpInterfaceProvider.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/PtpIpInterfaceProvider.java
@@ -1,9 +1,11 @@
11 package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper;
22
33 import android.app.Activity;
4+import android.content.SharedPreferences;
45 import android.util.Log;
56
67 import androidx.annotation.NonNull;
8+import androidx.preference.PreferenceManager;
79
810 import net.osdn.gokigen.pkremote.IInformationReceiver;
911 import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraButtonControl;
@@ -37,6 +39,7 @@ import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.liveview.PtpIpLiveV
3739 import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.playback.CanonPlaybackControl;
3840 import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.IPtpIpRunModeHolder;
3941 import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker;
42+import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
4043
4144 public class PtpIpInterfaceProvider implements IPtpIpInterfaceProvider, IDisplayInjector
4245 {
@@ -46,38 +49,68 @@ public class PtpIpInterfaceProvider implements IPtpIpInterfaceProvider, IDisplay
4649 private static final int ASYNC_RESPONSE_PORT = 15741; // ??
4750 private static final int CONTROL_PORT = 15740;
4851 private static final int EVENT_PORT = 15740;
49- private static final String CAMERA_IP = "192.168.0.1";
5052
51- private final Activity activity;
53+ //private static final String CAMERA_IP = "192.168.0.1";
54+ //private final Activity activity;
55+
5256 private final PtpIpRunMode runmode;
5357 private final PtpIpHardwareStatus hardwareStatus;
54- private PtpIpButtonControl ptpIpButtonControl;
55- private CanonConnection canonConnection;
56- private PtpIpCommandPublisher commandPublisher;
57- private PtpIpLiveViewControl liveViewControl;
58- private PtpIpAsyncResponseReceiver asyncReceiver;
59- private PtpIpZoomControl zoomControl;
58+ private final PtpIpButtonControl ptpIpButtonControl;
59+ private final CanonConnection canonConnection;
60+ private final PtpIpCommandPublisher commandPublisher;
61+ private final PtpIpLiveViewControl liveViewControl;
62+ private final PtpIpAsyncResponseReceiver asyncReceiver;
63+ private final PtpIpZoomControl zoomControl;
6064 //private PtpIpCaptureControl captureControl;
6165 //private PtpIpFocusingControl focusingControl;
62- private PtpIpStatusChecker statusChecker;
63- private ICameraStatusUpdateNotify statusListener;
64- private CanonPlaybackControl playbackControl;
65- private IInformationReceiver informationReceiver;
66+ private final PtpIpStatusChecker statusChecker;
67+ private final ICameraStatusUpdateNotify statusListener;
68+ private final CanonPlaybackControl playbackControl;
69+ private final IInformationReceiver informationReceiver;
6670
6771 public PtpIpInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider, @NonNull ICameraStatusUpdateNotify statusListener, @NonNull IInformationReceiver informationReceiver)
6872 {
69- this.activity = context;
70- commandPublisher = new PtpIpCommandPublisher(CAMERA_IP, CONTROL_PORT);
71- liveViewControl = new PtpIpLiveViewControl(context, CAMERA_IP, STREAM_PORT);
72- asyncReceiver = new PtpIpAsyncResponseReceiver(CAMERA_IP, ASYNC_RESPONSE_PORT);
73- statusChecker = new PtpIpStatusChecker(activity, commandPublisher, CAMERA_IP, EVENT_PORT);
74- canonConnection = new CanonConnection(context, provider, this, statusChecker);
73+ //this.activity = context;
74+ String ipAddress; // "192.168.0.1";
75+ int sequenceType = 0;
76+ try
77+ {
78+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
79+ ipAddress = preferences.getString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
80+ if (ipAddress == null)
81+ {
82+ ipAddress = "192.168.0.1";
83+ }
84+ try
85+ {
86+ String sequenceTypeStr = preferences.getString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
87+ if (sequenceTypeStr != null)
88+ {
89+ sequenceType = Integer.parseInt(sequenceTypeStr);
90+ }
91+ }
92+ catch (Exception e)
93+ {
94+ e.printStackTrace();
95+ }
96+ }
97+ catch (Exception e)
98+ {
99+ e.printStackTrace();
100+ ipAddress = "192.168.0.1";
101+ }
102+
103+ commandPublisher = new PtpIpCommandPublisher(ipAddress, CONTROL_PORT);
104+ liveViewControl = new PtpIpLiveViewControl(context, ipAddress, STREAM_PORT);
105+ asyncReceiver = new PtpIpAsyncResponseReceiver(ipAddress, ASYNC_RESPONSE_PORT);
106+ statusChecker = new PtpIpStatusChecker(context, commandPublisher, ipAddress, EVENT_PORT);
107+ canonConnection = new CanonConnection(context, provider, this, statusChecker, sequenceType);
75108 zoomControl = new PtpIpZoomControl();
76109 this.statusListener = statusListener;
77110 this.runmode = new PtpIpRunMode();
78111 this.hardwareStatus = new PtpIpHardwareStatus();
79112 this.ptpIpButtonControl = new PtpIpButtonControl();
80- this.playbackControl = new CanonPlaybackControl(activity, this);
113+ this.playbackControl = new CanonPlaybackControl(context, this);
81114 this.informationReceiver = informationReceiver;
82115 }
83116
--- /dev/null
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraConnectSequenceForPlaybackType1.kt
@@ -0,0 +1,197 @@
1+package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection
2+
3+import android.app.Activity
4+import android.graphics.Color
5+import android.util.Log
6+import net.osdn.gokigen.pkremote.R
7+import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraConnection
8+import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusReceiver
9+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.IPtpIpInterfaceProvider
10+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandCallback
11+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpMessages
12+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandGeneric
13+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker
14+
15+class CanonCameraConnectSequenceForPlaybackType1(val context: Activity, val cameraStatusReceiver: ICameraStatusReceiver, val cameraConnection: ICameraConnection, val interfaceProvider: IPtpIpInterfaceProvider, val statusChecker: PtpIpStatusChecker) : Runnable, IPtpIpCommandCallback, IPtpIpMessages
16+{
17+ private val isDumpLog = true
18+ private val commandIssuer = interfaceProvider.commandPublisher
19+ //private var requestMessageCount = 0
20+
21+ override fun run()
22+ {
23+ try
24+ {
25+ Log.v(TAG, " CanonCameraConnectSequenceForPlaybackType1 START!")
26+
27+ // カメラとTCP接続
28+ val issuer = interfaceProvider.commandPublisher
29+ if (!issuer.isConnected)
30+ {
31+ if (!interfaceProvider.commandCommunication.connect())
32+ {
33+ // 接続失敗...
34+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.dialog_title_connect_failed_canon), false, true, Color.RED)
35+ cameraConnection.alertConnectingFailed(context.getString(R.string.dialog_title_connect_failed_canon))
36+ return
37+ }
38+ }
39+ else
40+ {
41+ Log.v(TAG, "SOCKET IS ALREADY CONNECTED...")
42+ }
43+ // コマンドタスクの実行開始
44+ issuer.start()
45+
46+ // 接続シーケンスの開始
47+ sendRegistrationMessage()
48+ }
49+ catch (e: Exception)
50+ {
51+ e.printStackTrace()
52+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.dialog_title_connect_failed_canon), false, true, Color.RED)
53+ cameraConnection.alertConnectingFailed(e.message)
54+ }
55+ }
56+
57+ override fun onReceiveProgress(currentBytes: Int, totalBytes: Int, body: ByteArray?)
58+ {
59+ Log.v(TAG, " $currentBytes/$totalBytes")
60+ }
61+
62+ override fun isReceiveMulti(): Boolean
63+ {
64+ return false
65+ }
66+
67+ @ExperimentalUnsignedTypes
68+ override fun receivedMessage(id: Int, rx_body: ByteArray)
69+ {
70+ when (id)
71+ {
72+ IPtpIpMessages.SEQ_REGISTRATION -> if (checkRegistrationMessage(rx_body)) {
73+ sendInitEventRequest(rx_body)
74+ } else {
75+ cameraConnection.alertConnectingFailed(context.getString(R.string.connect_error_message))
76+ }
77+ IPtpIpMessages.SEQ_EVENT_INITIALIZE -> if (checkEventInitialize(rx_body)) {
78+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting1), false, false, 0)
79+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41))
80+ } else {
81+ cameraConnection.alertConnectingFailed(context.getString(R.string.connect_error_message))
82+ }
83+ IPtpIpMessages.SEQ_OPEN_SESSION -> {
84+ Log.v(TAG, " SEQ_OPEN_SESSION ")
85+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting2), false, false, 0)
86+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_INIT_SESSION, isDumpLog, 0, 0x902f))
87+ }
88+ IPtpIpMessages.SEQ_INIT_SESSION -> {
89+ Log.v(TAG, " SEQ_INIT_SESSION ")
90+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting3), false, false, 0)
91+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_CHANGE_REMOTE, isDumpLog, 0, 0x9114, 4, 0x15))
92+ }
93+ IPtpIpMessages.SEQ_CHANGE_REMOTE -> {
94+ Log.v(TAG, " SEQ_CHANGE_REMOTE ")
95+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting4), false, false, 0)
96+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_SET_EVENT_MODE, isDumpLog, 0, 0x9115, 4, 0x02))
97+ }
98+ IPtpIpMessages.SEQ_SET_EVENT_MODE -> {
99+ Log.v(TAG, " SEQ_SET_EVENT_MODE ")
100+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting5), false, false, 0)
101+ Log.v(TAG, " SEQ_DEVICE_PROPERTY_FINISHED ")
102+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connect_finished), false, false, 0)
103+ connectFinished()
104+ Log.v(TAG, "CHANGED MODE : DONE.")
105+ }
106+ else -> {
107+ Log.v(TAG, "RECEIVED UNKNOWN ID : $id")
108+ cameraConnection.alertConnectingFailed(context.getString(R.string.connect_receive_unknown_message))
109+ }
110+ }
111+ }
112+
113+ private fun sendRegistrationMessage()
114+ {
115+ Log.v(TAG, " sendRegistrationMessage() ")
116+
117+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_start), false, false, 0)
118+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start))
119+ //commandIssuer.enqueueCommand(CanonRegistrationMessage(this))
120+ }
121+
122+ @ExperimentalUnsignedTypes
123+ private fun sendInitEventRequest(receiveData: ByteArray)
124+ {
125+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_start_2), false, false, 0)
126+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start_2))
127+ try
128+ {
129+ var eventConnectionNumber: Int = receiveData[8].toUByte().toInt() and 0xff
130+ eventConnectionNumber += (receiveData[9].toUByte().toInt() and 0xff shl 8)
131+ eventConnectionNumber += (receiveData[10].toUByte().toInt() and 0xff shl 16)
132+ eventConnectionNumber += (receiveData[11].toUByte().toInt() and 0xff shl 24)
133+ statusChecker.setEventConnectionNumber(eventConnectionNumber)
134+ interfaceProvider.cameraStatusWatcher.startStatusWatch(interfaceProvider.statusListener)
135+ commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41))
136+ }
137+ catch (e: Exception)
138+ {
139+ e.printStackTrace()
140+ }
141+ }
142+
143+ private fun checkRegistrationMessage(receiveData: ByteArray?): Boolean
144+ {
145+ // データ(Connection Number)がないときにはエラーと判断する
146+ return !(receiveData == null || receiveData.size < 12)
147+ }
148+
149+ private fun checkEventInitialize(receiveData: ByteArray?): Boolean
150+ {
151+ Log.v(TAG, "checkEventInitialize() ")
152+ return receiveData != null
153+ }
154+
155+ private fun connectFinished()
156+ {
157+ try
158+ {
159+ // 接続成功のメッセージを出す
160+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connected), false, false, 0)
161+
162+ // ちょっと待つ
163+ Thread.sleep(1000)
164+
165+ // 接続成功!のメッセージを出す
166+ interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connected), false, false, 0)
167+ onConnectNotify()
168+ }
169+ catch (e: Exception)
170+ {
171+ e.printStackTrace()
172+ }
173+ }
174+
175+ private fun onConnectNotify()
176+ {
177+ try
178+ {
179+ val thread = Thread {
180+ // カメラとの接続確立を通知する
181+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connected))
182+ cameraStatusReceiver.onCameraConnected()
183+ Log.v(TAG, " onConnectNotify()")
184+ }
185+ thread.start()
186+ }
187+ catch (e: Exception)
188+ {
189+ e.printStackTrace()
190+ }
191+ }
192+
193+ companion object
194+ {
195+ private const val TAG = "CanonConnectSeq.1"
196+ }
197+}
--- a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraDisconnectSequence.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraDisconnectSequence.java
@@ -1,6 +1,7 @@
11 package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection;
22
33 import android.app.Activity;
4+import android.util.Log;
45
56 import androidx.annotation.NonNull;
67
@@ -29,6 +30,7 @@ class CanonCameraDisconnectSequence implements Runnable
2930 {
3031 try
3132 {
33+ Log.v(TAG, " disconnect");
3234 liveview.disconnect();
3335 async.disconnect();
3436 command.disconnect();
--- a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonConnection.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonConnection.java
@@ -33,15 +33,17 @@ public class CanonConnection implements ICameraConnection
3333 private final BroadcastReceiver connectionReceiver;
3434 private final Executor cameraExecutor = Executors.newFixedThreadPool(1);
3535 private final PtpIpStatusChecker statusChecker;
36+ private final int sequenceType;
3637 private CameraConnectionStatus connectionStatus = CameraConnectionStatus.UNKNOWN;
3738
38- public CanonConnection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IPtpIpInterfaceProvider interfaceProvider, @NonNull PtpIpStatusChecker statusChecker)
39+ public CanonConnection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IPtpIpInterfaceProvider interfaceProvider, @NonNull PtpIpStatusChecker statusChecker, int sequenceType)
3940 {
4041 Log.v(TAG, "CanonConnection()");
4142 this.context = context;
4243 this.statusReceiver = statusReceiver;
4344 this.interfaceProvider = interfaceProvider;
4445 this.statusChecker = statusChecker;
46+ this.sequenceType = sequenceType;
4547 connectionReceiver = new BroadcastReceiver()
4648 {
4749 @Override
@@ -204,7 +206,7 @@ public class CanonConnection implements ICameraConnection
204206 */
205207 private void disconnectFromCamera(final boolean powerOff)
206208 {
207- Log.v(TAG, " disconnectFromCamera()");
209+ Log.v(TAG, " disconnectFromCamera() : " + powerOff);
208210 try
209211 {
210212 cameraExecutor.execute(new CanonCameraDisconnectSequence(context, interfaceProvider));
@@ -224,7 +226,16 @@ public class CanonConnection implements ICameraConnection
224226 connectionStatus = CameraConnectionStatus.CONNECTING;
225227 try
226228 {
227- cameraExecutor.execute(new CanonCameraConnectSequenceForPlayback(context, statusReceiver, this, interfaceProvider, statusChecker));
229+/*
230+ if (sequenceType == 1)
231+ {
232+ cameraExecutor.execute(new CanonCameraConnectSequenceForPlaybackType1(context, statusReceiver, this, interfaceProvider, statusChecker));
233+ }
234+ else
235+*/
236+ {
237+ cameraExecutor.execute(new CanonCameraConnectSequenceForPlayback(context, statusReceiver, this, interfaceProvider, statusChecker));
238+ }
228239 }
229240 catch (Exception e)
230241 {
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/IPreferencePropertyAccessor.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/IPreferencePropertyAccessor.java
@@ -131,6 +131,12 @@ public interface IPreferencePropertyAccessor
131131 String THUMBNAIL_IMAGE_CACHE_SIZE = "thumbnail_image_cache_size";
132132 String THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE = "120";
133133
134+ String CANON_HOST_IP = "canon_host_ip";
135+ String CANON_HOST_IP_DEFAULT_VALUE = "192.168.0.1";
136+
137+ String CANON_CONNECTION_SEQUENCE = "canon_connection_mode";
138+ String CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE = "0";
139+
134140 /*
135141 //String GR2_DISPLAY_MODE = "gr2_display_mode";
136142 //String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0";
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/canon/CanonPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/canon/CanonPreferenceFragment.java
@@ -173,6 +173,12 @@ public class CanonPreferenceFragment extends PreferenceFragmentCompat implement
173173 {
174174 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
175175 }
176+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
177+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
178+ }
179+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
180+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
181+ }
176182 editor.apply();
177183 }
178184 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/fujix/FujiXPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/fujix/FujiXPreferenceFragment.java
@@ -173,6 +173,12 @@ public class FujiXPreferenceFragment extends PreferenceFragmentCompat implement
173173 {
174174 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
175175 }
176+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
177+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
178+ }
179+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
180+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
181+ }
176182 editor.apply();
177183 }
178184 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/nikon/NikonPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/nikon/NikonPreferenceFragment.java
@@ -170,6 +170,12 @@ public class NikonPreferenceFragment extends PreferenceFragmentCompat implement
170170 {
171171 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
172172 }
173+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
174+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
175+ }
176+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
177+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
178+ }
173179 editor.apply();
174180 }
175181 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/olympus/OpcPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/olympus/OpcPreferenceFragment.java
@@ -199,6 +199,12 @@ public class OpcPreferenceFragment extends PreferenceFragmentCompat implements S
199199 {
200200 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
201201 }
202+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
203+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
204+ }
205+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
206+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
207+ }
202208 editor.apply();
203209 }
204210
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/olympuspen/OlympusPenPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/olympuspen/OlympusPenPreferenceFragment.java
@@ -164,6 +164,12 @@ public class OlympusPenPreferenceFragment extends PreferenceFragmentCompat impl
164164 {
165165 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
166166 }
167+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
168+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
169+ }
170+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
171+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
172+ }
167173 editor.apply();
168174 }
169175 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/panasonic/PanasonicPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/panasonic/PanasonicPreferenceFragment.java
@@ -162,6 +162,12 @@ public class PanasonicPreferenceFragment extends PreferenceFragmentCompat imple
162162 {
163163 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
164164 }
165+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
166+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
167+ }
168+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
169+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
170+ }
165171 editor.apply();
166172 }
167173 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/pixpro/PixproPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/pixpro/PixproPreferenceFragment.java
@@ -161,6 +161,12 @@ public class PixproPreferenceFragment extends PreferenceFragmentCompat implemen
161161 {
162162 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
163163 }
164+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
165+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
166+ }
167+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
168+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
169+ }
164170 editor.apply();
165171 }
166172 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/ricohgr2/RicohGr2PreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/ricohgr2/RicohGr2PreferenceFragment.java
@@ -177,6 +177,12 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem
177177 {
178178 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
179179 }
180+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
181+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
182+ }
183+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
184+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
185+ }
180186 editor.apply();
181187 }
182188 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/sony/SonyPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/sony/SonyPreferenceFragment.java
@@ -159,6 +159,12 @@ public class SonyPreferenceFragment extends PreferenceFragmentCompat implements
159159 {
160160 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
161161 }
162+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
163+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
164+ }
165+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
166+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
167+ }
162168 editor.apply();
163169 }
164170 catch (Exception e)
--- a/app/src/main/java/net/osdn/gokigen/pkremote/preference/theta/ThetaPreferenceFragment.java
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/preference/theta/ThetaPreferenceFragment.java
@@ -161,6 +161,12 @@ public class ThetaPreferenceFragment extends PreferenceFragmentCompat implement
161161 {
162162 editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE);
163163 }
164+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) {
165+ editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE);
166+ }
167+ if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) {
168+ editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE);
169+ }
164170 editor.apply();
165171 }
166172 catch (Exception e)
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -372,4 +372,10 @@
372372 <string name="pref_thumbnail_image_cache_size">サムネイル画像キャッシュ数</string>
373373 <string name="pref_summary_thumbnail_image_cache_size">小メモリ機の場合には、この値を減らしてください。(初期値:120)</string>
374374
375+ <string name="pref_canon_host_ip">カメラIPアドレス</string>
376+ <string name="pref_summary_canon_host_ip">通常、変更は不要です (初期値:192.168.0.1)</string>
377+
378+ <string name="pref_canon_connection_mode">接続シーケンス</string>
379+ <string name="pref_summary_canon_connection_mode">通常、変更は不要です (初期値: TYPE0)</string>
380+
375381 </resources>
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -104,4 +104,16 @@
104104 <item>sd2</item>
105105 </string-array>
106106
107+ <string-array name="canon_connection_mode">
108+ <item>TYPE0</item>
109+ <item>TYPE1</item>
110+ <item>TYPE2</item>
111+ </string-array>
112+
113+ <string-array name="canon_connection_mode_value">
114+ <item>0</item>
115+ <item>1</item>
116+ <item>2</item>
117+ </string-array>
118+
107119 </resources>
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -374,4 +374,10 @@
374374 <string name="pref_thumbnail_image_cache_size">Thumbnail image cache size</string>
375375 <string name="pref_summary_thumbnail_image_cache_size">If you use low memory machine, please decrease this value.(default:120)</string>
376376
377+ <string name="pref_canon_host_ip">Camera IP Address</string>
378+ <string name="pref_summary_canon_host_ip">default: 192.168.0.1 </string>
379+
380+ <string name="pref_canon_connection_mode">Connection Sequence</string>
381+ <string name="pref_summary_canon_connection_mode">default: TYPE0 </string>
382+
377383 </resources>
--- a/app/src/main/res/xml/preferences_canon.xml
+++ b/app/src/main/res/xml/preferences_canon.xml
@@ -43,6 +43,20 @@
4343 android:defaultValue="20"
4444 android:summary="@string/pref_summary_canon_receive_wait" />
4545
46+ <EditTextPreference
47+ android:key="canon_host_ip"
48+ android:title="@string/pref_canon_host_ip"
49+ android:defaultValue="192.168.0.1"
50+ android:summary="@string/pref_summary_canon_host_ip" />
51+
52+ <ListPreference
53+ android:title="@string/pref_canon_connection_mode"
54+ android:summary="@string/pref_summary_canon_connection_mode"
55+ android:entryValues="@array/canon_connection_mode_value"
56+ android:entries="@array/canon_connection_mode"
57+ android:key="canon_connection_mode"
58+ android:defaultValue="0"/>
59+
4660 <!--
4761
4862 <PreferenceScreen
Afficher sur ancien navigateur de dépôt.