Pentax DSLR Remote Control app.
Révision | 95b907aa6cab7c9e8e8036c7b6ddd855e115cd1c (tree) |
---|---|
l'heure | 2020-12-30 23:17:48 |
Auteur | MRSa <mrsa@myad...> |
Commiter | MRSa |
とりあえず、Power Shot Zoomから画像をダウンロードできるところまで。
@@ -1,9 +1,11 @@ | ||
1 | 1 | package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper; |
2 | 2 | |
3 | 3 | import android.app.Activity; |
4 | +import android.content.SharedPreferences; | |
4 | 5 | import android.util.Log; |
5 | 6 | |
6 | 7 | import androidx.annotation.NonNull; |
8 | +import androidx.preference.PreferenceManager; | |
7 | 9 | |
8 | 10 | import net.osdn.gokigen.pkremote.IInformationReceiver; |
9 | 11 | import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraButtonControl; |
@@ -37,6 +39,7 @@ import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.liveview.PtpIpLiveV | ||
37 | 39 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.playback.CanonPlaybackControl; |
38 | 40 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.IPtpIpRunModeHolder; |
39 | 41 | import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker; |
42 | +import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor; | |
40 | 43 | |
41 | 44 | public class PtpIpInterfaceProvider implements IPtpIpInterfaceProvider, IDisplayInjector |
42 | 45 | { |
@@ -46,38 +49,68 @@ public class PtpIpInterfaceProvider implements IPtpIpInterfaceProvider, IDisplay | ||
46 | 49 | private static final int ASYNC_RESPONSE_PORT = 15741; // ?? |
47 | 50 | private static final int CONTROL_PORT = 15740; |
48 | 51 | private static final int EVENT_PORT = 15740; |
49 | - private static final String CAMERA_IP = "192.168.0.1"; | |
50 | 52 | |
51 | - private final Activity activity; | |
53 | + //private static final String CAMERA_IP = "192.168.0.1"; | |
54 | + //private final Activity activity; | |
55 | + | |
52 | 56 | private final PtpIpRunMode runmode; |
53 | 57 | 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; | |
60 | 64 | //private PtpIpCaptureControl captureControl; |
61 | 65 | //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; | |
66 | 70 | |
67 | 71 | public PtpIpInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider, @NonNull ICameraStatusUpdateNotify statusListener, @NonNull IInformationReceiver informationReceiver) |
68 | 72 | { |
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); | |
75 | 108 | zoomControl = new PtpIpZoomControl(); |
76 | 109 | this.statusListener = statusListener; |
77 | 110 | this.runmode = new PtpIpRunMode(); |
78 | 111 | this.hardwareStatus = new PtpIpHardwareStatus(); |
79 | 112 | this.ptpIpButtonControl = new PtpIpButtonControl(); |
80 | - this.playbackControl = new CanonPlaybackControl(activity, this); | |
113 | + this.playbackControl = new CanonPlaybackControl(context, this); | |
81 | 114 | this.informationReceiver = informationReceiver; |
82 | 115 | } |
83 | 116 |
@@ -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 | +} |
@@ -1,6 +1,7 @@ | ||
1 | 1 | package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection; |
2 | 2 | |
3 | 3 | import android.app.Activity; |
4 | +import android.util.Log; | |
4 | 5 | |
5 | 6 | import androidx.annotation.NonNull; |
6 | 7 |
@@ -29,6 +30,7 @@ class CanonCameraDisconnectSequence implements Runnable | ||
29 | 30 | { |
30 | 31 | try |
31 | 32 | { |
33 | + Log.v(TAG, " disconnect"); | |
32 | 34 | liveview.disconnect(); |
33 | 35 | async.disconnect(); |
34 | 36 | command.disconnect(); |
@@ -33,15 +33,17 @@ public class CanonConnection implements ICameraConnection | ||
33 | 33 | private final BroadcastReceiver connectionReceiver; |
34 | 34 | private final Executor cameraExecutor = Executors.newFixedThreadPool(1); |
35 | 35 | private final PtpIpStatusChecker statusChecker; |
36 | + private final int sequenceType; | |
36 | 37 | private CameraConnectionStatus connectionStatus = CameraConnectionStatus.UNKNOWN; |
37 | 38 | |
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) | |
39 | 40 | { |
40 | 41 | Log.v(TAG, "CanonConnection()"); |
41 | 42 | this.context = context; |
42 | 43 | this.statusReceiver = statusReceiver; |
43 | 44 | this.interfaceProvider = interfaceProvider; |
44 | 45 | this.statusChecker = statusChecker; |
46 | + this.sequenceType = sequenceType; | |
45 | 47 | connectionReceiver = new BroadcastReceiver() |
46 | 48 | { |
47 | 49 | @Override |
@@ -204,7 +206,7 @@ public class CanonConnection implements ICameraConnection | ||
204 | 206 | */ |
205 | 207 | private void disconnectFromCamera(final boolean powerOff) |
206 | 208 | { |
207 | - Log.v(TAG, " disconnectFromCamera()"); | |
209 | + Log.v(TAG, " disconnectFromCamera() : " + powerOff); | |
208 | 210 | try |
209 | 211 | { |
210 | 212 | cameraExecutor.execute(new CanonCameraDisconnectSequence(context, interfaceProvider)); |
@@ -224,7 +226,16 @@ public class CanonConnection implements ICameraConnection | ||
224 | 226 | connectionStatus = CameraConnectionStatus.CONNECTING; |
225 | 227 | try |
226 | 228 | { |
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 | + } | |
228 | 239 | } |
229 | 240 | catch (Exception e) |
230 | 241 | { |
@@ -131,6 +131,12 @@ public interface IPreferencePropertyAccessor | ||
131 | 131 | String THUMBNAIL_IMAGE_CACHE_SIZE = "thumbnail_image_cache_size"; |
132 | 132 | String THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE = "120"; |
133 | 133 | |
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 | + | |
134 | 140 | /* |
135 | 141 | //String GR2_DISPLAY_MODE = "gr2_display_mode"; |
136 | 142 | //String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0"; |
@@ -173,6 +173,12 @@ public class CanonPreferenceFragment extends PreferenceFragmentCompat implement | ||
173 | 173 | { |
174 | 174 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
175 | 175 | } |
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 | + } | |
176 | 182 | editor.apply(); |
177 | 183 | } |
178 | 184 | catch (Exception e) |
@@ -173,6 +173,12 @@ public class FujiXPreferenceFragment extends PreferenceFragmentCompat implement | ||
173 | 173 | { |
174 | 174 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
175 | 175 | } |
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 | + } | |
176 | 182 | editor.apply(); |
177 | 183 | } |
178 | 184 | catch (Exception e) |
@@ -170,6 +170,12 @@ public class NikonPreferenceFragment extends PreferenceFragmentCompat implement | ||
170 | 170 | { |
171 | 171 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
172 | 172 | } |
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 | + } | |
173 | 179 | editor.apply(); |
174 | 180 | } |
175 | 181 | catch (Exception e) |
@@ -199,6 +199,12 @@ public class OpcPreferenceFragment extends PreferenceFragmentCompat implements S | ||
199 | 199 | { |
200 | 200 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
201 | 201 | } |
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 | + } | |
202 | 208 | editor.apply(); |
203 | 209 | } |
204 | 210 |
@@ -164,6 +164,12 @@ public class OlympusPenPreferenceFragment extends PreferenceFragmentCompat impl | ||
164 | 164 | { |
165 | 165 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
166 | 166 | } |
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 | + } | |
167 | 173 | editor.apply(); |
168 | 174 | } |
169 | 175 | catch (Exception e) |
@@ -162,6 +162,12 @@ public class PanasonicPreferenceFragment extends PreferenceFragmentCompat imple | ||
162 | 162 | { |
163 | 163 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
164 | 164 | } |
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 | + } | |
165 | 171 | editor.apply(); |
166 | 172 | } |
167 | 173 | catch (Exception e) |
@@ -161,6 +161,12 @@ public class PixproPreferenceFragment extends PreferenceFragmentCompat implemen | ||
161 | 161 | { |
162 | 162 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
163 | 163 | } |
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 | + } | |
164 | 170 | editor.apply(); |
165 | 171 | } |
166 | 172 | catch (Exception e) |
@@ -177,6 +177,12 @@ public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implem | ||
177 | 177 | { |
178 | 178 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
179 | 179 | } |
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 | + } | |
180 | 186 | editor.apply(); |
181 | 187 | } |
182 | 188 | catch (Exception e) |
@@ -159,6 +159,12 @@ public class SonyPreferenceFragment extends PreferenceFragmentCompat implements | ||
159 | 159 | { |
160 | 160 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
161 | 161 | } |
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 | + } | |
162 | 168 | editor.apply(); |
163 | 169 | } |
164 | 170 | catch (Exception e) |
@@ -161,6 +161,12 @@ public class ThetaPreferenceFragment extends PreferenceFragmentCompat implement | ||
161 | 161 | { |
162 | 162 | editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); |
163 | 163 | } |
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 | + } | |
164 | 170 | editor.apply(); |
165 | 171 | } |
166 | 172 | catch (Exception e) |
@@ -372,4 +372,10 @@ | ||
372 | 372 | <string name="pref_thumbnail_image_cache_size">サムネイル画像キャッシュ数</string> |
373 | 373 | <string name="pref_summary_thumbnail_image_cache_size">小メモリ機の場合には、この値を減らしてください。(初期値:120)</string> |
374 | 374 | |
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 | + | |
375 | 381 | </resources> |
@@ -104,4 +104,16 @@ | ||
104 | 104 | <item>sd2</item> |
105 | 105 | </string-array> |
106 | 106 | |
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 | + | |
107 | 119 | </resources> |
@@ -374,4 +374,10 @@ | ||
374 | 374 | <string name="pref_thumbnail_image_cache_size">Thumbnail image cache size</string> |
375 | 375 | <string name="pref_summary_thumbnail_image_cache_size">If you use low memory machine, please decrease this value.(default:120)</string> |
376 | 376 | |
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 | + | |
377 | 383 | </resources> |
@@ -43,6 +43,20 @@ | ||
43 | 43 | android:defaultValue="20" |
44 | 44 | android:summary="@string/pref_summary_canon_receive_wait" /> |
45 | 45 | |
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 | + | |
46 | 60 | <!-- |
47 | 61 | |
48 | 62 | <PreferenceScreen |