From 95b907aa6cab7c9e8e8036c7b6ddd855e115cd1c Mon Sep 17 00:00:00 2001 From: MRSa Date: Wed, 30 Dec 2020 23:17:48 +0900 Subject: [PATCH 1/1] =?utf8?q?=E3=81=A8=E3=82=8A=E3=81=82=E3=81=88?= =?utf8?q?=E3=81=9A=E3=80=81Power=20Shot=20Zoom=E3=81=8B=E3=82=89=E7=94=BB?= =?utf8?q?=E5=83=8F=E3=82=92=E3=83=80=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC?= =?utf8?q?=E3=83=89=E3=81=A7=E3=81=8D=E3=82=8B=E3=81=A8=E3=81=93=E3=82=8D?= =?utf8?q?=E3=81=BE=E3=81=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../ptpip/wrapper/PtpIpInterfaceProvider.java | 71 ++++++-- .../CanonCameraConnectSequenceForPlaybackType1.kt | 197 +++++++++++++++++++++ .../connection/CanonCameraDisconnectSequence.java | 2 + .../ptpip/wrapper/connection/CanonConnection.java | 17 +- .../preference/IPreferencePropertyAccessor.java | 6 + .../preference/canon/CanonPreferenceFragment.java | 6 + .../preference/fujix/FujiXPreferenceFragment.java | 6 + .../preference/nikon/NikonPreferenceFragment.java | 6 + .../preference/olympus/OpcPreferenceFragment.java | 6 + .../olympuspen/OlympusPenPreferenceFragment.java | 6 + .../panasonic/PanasonicPreferenceFragment.java | 6 + .../pixpro/PixproPreferenceFragment.java | 6 + .../ricohgr2/RicohGr2PreferenceFragment.java | 6 + .../preference/sony/SonyPreferenceFragment.java | 6 + .../preference/theta/ThetaPreferenceFragment.java | 6 + app/src/main/res/values-ja/strings.xml | 6 + app/src/main/res/values/arrays.xml | 12 ++ app/src/main/res/values/strings.xml | 6 + app/src/main/res/xml/preferences_canon.xml | 14 ++ 19 files changed, 369 insertions(+), 22 deletions(-) create mode 100644 app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraConnectSequenceForPlaybackType1.kt diff --git 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 index eb9cf2c..bc08cf8 100644 --- 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 @@ package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper; import android.app.Activity; +import android.content.SharedPreferences; import android.util.Log; import androidx.annotation.NonNull; +import androidx.preference.PreferenceManager; import net.osdn.gokigen.pkremote.IInformationReceiver; import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraButtonControl; @@ -37,6 +39,7 @@ import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.liveview.PtpIpLiveV import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.playback.CanonPlaybackControl; import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.IPtpIpRunModeHolder; import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker; +import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor; public class PtpIpInterfaceProvider implements IPtpIpInterfaceProvider, IDisplayInjector { @@ -46,38 +49,68 @@ public class PtpIpInterfaceProvider implements IPtpIpInterfaceProvider, IDisplay private static final int ASYNC_RESPONSE_PORT = 15741; // ?? private static final int CONTROL_PORT = 15740; private static final int EVENT_PORT = 15740; - private static final String CAMERA_IP = "192.168.0.1"; - private final Activity activity; + //private static final String CAMERA_IP = "192.168.0.1"; + //private final Activity activity; + private final PtpIpRunMode runmode; private final PtpIpHardwareStatus hardwareStatus; - private PtpIpButtonControl ptpIpButtonControl; - private CanonConnection canonConnection; - private PtpIpCommandPublisher commandPublisher; - private PtpIpLiveViewControl liveViewControl; - private PtpIpAsyncResponseReceiver asyncReceiver; - private PtpIpZoomControl zoomControl; + private final PtpIpButtonControl ptpIpButtonControl; + private final CanonConnection canonConnection; + private final PtpIpCommandPublisher commandPublisher; + private final PtpIpLiveViewControl liveViewControl; + private final PtpIpAsyncResponseReceiver asyncReceiver; + private final PtpIpZoomControl zoomControl; //private PtpIpCaptureControl captureControl; //private PtpIpFocusingControl focusingControl; - private PtpIpStatusChecker statusChecker; - private ICameraStatusUpdateNotify statusListener; - private CanonPlaybackControl playbackControl; - private IInformationReceiver informationReceiver; + private final PtpIpStatusChecker statusChecker; + private final ICameraStatusUpdateNotify statusListener; + private final CanonPlaybackControl playbackControl; + private final IInformationReceiver informationReceiver; public PtpIpInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider, @NonNull ICameraStatusUpdateNotify statusListener, @NonNull IInformationReceiver informationReceiver) { - this.activity = context; - commandPublisher = new PtpIpCommandPublisher(CAMERA_IP, CONTROL_PORT); - liveViewControl = new PtpIpLiveViewControl(context, CAMERA_IP, STREAM_PORT); - asyncReceiver = new PtpIpAsyncResponseReceiver(CAMERA_IP, ASYNC_RESPONSE_PORT); - statusChecker = new PtpIpStatusChecker(activity, commandPublisher, CAMERA_IP, EVENT_PORT); - canonConnection = new CanonConnection(context, provider, this, statusChecker); + //this.activity = context; + String ipAddress; // "192.168.0.1"; + int sequenceType = 0; + try + { + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + ipAddress = preferences.getString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + if (ipAddress == null) + { + ipAddress = "192.168.0.1"; + } + try + { + String sequenceTypeStr = preferences.getString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + if (sequenceTypeStr != null) + { + sequenceType = Integer.parseInt(sequenceTypeStr); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + catch (Exception e) + { + e.printStackTrace(); + ipAddress = "192.168.0.1"; + } + + commandPublisher = new PtpIpCommandPublisher(ipAddress, CONTROL_PORT); + liveViewControl = new PtpIpLiveViewControl(context, ipAddress, STREAM_PORT); + asyncReceiver = new PtpIpAsyncResponseReceiver(ipAddress, ASYNC_RESPONSE_PORT); + statusChecker = new PtpIpStatusChecker(context, commandPublisher, ipAddress, EVENT_PORT); + canonConnection = new CanonConnection(context, provider, this, statusChecker, sequenceType); zoomControl = new PtpIpZoomControl(); this.statusListener = statusListener; this.runmode = new PtpIpRunMode(); this.hardwareStatus = new PtpIpHardwareStatus(); this.ptpIpButtonControl = new PtpIpButtonControl(); - this.playbackControl = new CanonPlaybackControl(activity, this); + this.playbackControl = new CanonPlaybackControl(context, this); this.informationReceiver = informationReceiver; } diff --git a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraConnectSequenceForPlaybackType1.kt b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraConnectSequenceForPlaybackType1.kt new file mode 100644 index 0000000..72ea1d8 --- /dev/null +++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraConnectSequenceForPlaybackType1.kt @@ -0,0 +1,197 @@ +package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection + +import android.app.Activity +import android.graphics.Color +import android.util.Log +import net.osdn.gokigen.pkremote.R +import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraConnection +import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusReceiver +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.IPtpIpInterfaceProvider +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpCommandCallback +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.IPtpIpMessages +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.command.messages.PtpIpCommandGeneric +import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.status.PtpIpStatusChecker + +class CanonCameraConnectSequenceForPlaybackType1(val context: Activity, val cameraStatusReceiver: ICameraStatusReceiver, val cameraConnection: ICameraConnection, val interfaceProvider: IPtpIpInterfaceProvider, val statusChecker: PtpIpStatusChecker) : Runnable, IPtpIpCommandCallback, IPtpIpMessages +{ + private val isDumpLog = true + private val commandIssuer = interfaceProvider.commandPublisher + //private var requestMessageCount = 0 + + override fun run() + { + try + { + Log.v(TAG, " CanonCameraConnectSequenceForPlaybackType1 START!") + + // カメラとTCP接続 + val issuer = interfaceProvider.commandPublisher + if (!issuer.isConnected) + { + if (!interfaceProvider.commandCommunication.connect()) + { + // 接続失敗... + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.dialog_title_connect_failed_canon), false, true, Color.RED) + cameraConnection.alertConnectingFailed(context.getString(R.string.dialog_title_connect_failed_canon)) + return + } + } + else + { + Log.v(TAG, "SOCKET IS ALREADY CONNECTED...") + } + // コマンドタスクの実行開始 + issuer.start() + + // 接続シーケンスの開始 + sendRegistrationMessage() + } + catch (e: Exception) + { + e.printStackTrace() + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.dialog_title_connect_failed_canon), false, true, Color.RED) + cameraConnection.alertConnectingFailed(e.message) + } + } + + override fun onReceiveProgress(currentBytes: Int, totalBytes: Int, body: ByteArray?) + { + Log.v(TAG, " $currentBytes/$totalBytes") + } + + override fun isReceiveMulti(): Boolean + { + return false + } + + @ExperimentalUnsignedTypes + override fun receivedMessage(id: Int, rx_body: ByteArray) + { + when (id) + { + IPtpIpMessages.SEQ_REGISTRATION -> if (checkRegistrationMessage(rx_body)) { + sendInitEventRequest(rx_body) + } else { + cameraConnection.alertConnectingFailed(context.getString(R.string.connect_error_message)) + } + IPtpIpMessages.SEQ_EVENT_INITIALIZE -> if (checkEventInitialize(rx_body)) { + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting1), false, false, 0) + commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41)) + } else { + cameraConnection.alertConnectingFailed(context.getString(R.string.connect_error_message)) + } + IPtpIpMessages.SEQ_OPEN_SESSION -> { + Log.v(TAG, " SEQ_OPEN_SESSION ") + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting2), false, false, 0) + commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_INIT_SESSION, isDumpLog, 0, 0x902f)) + } + IPtpIpMessages.SEQ_INIT_SESSION -> { + Log.v(TAG, " SEQ_INIT_SESSION ") + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting3), false, false, 0) + commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_CHANGE_REMOTE, isDumpLog, 0, 0x9114, 4, 0x15)) + } + IPtpIpMessages.SEQ_CHANGE_REMOTE -> { + Log.v(TAG, " SEQ_CHANGE_REMOTE ") + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting4), false, false, 0) + commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_SET_EVENT_MODE, isDumpLog, 0, 0x9115, 4, 0x02)) + } + IPtpIpMessages.SEQ_SET_EVENT_MODE -> { + Log.v(TAG, " SEQ_SET_EVENT_MODE ") + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.canon_connect_connecting5), false, false, 0) + Log.v(TAG, " SEQ_DEVICE_PROPERTY_FINISHED ") + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connect_finished), false, false, 0) + connectFinished() + Log.v(TAG, "CHANGED MODE : DONE.") + } + else -> { + Log.v(TAG, "RECEIVED UNKNOWN ID : $id") + cameraConnection.alertConnectingFailed(context.getString(R.string.connect_receive_unknown_message)) + } + } + } + + private fun sendRegistrationMessage() + { + Log.v(TAG, " sendRegistrationMessage() ") + + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_start), false, false, 0) + cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start)) + //commandIssuer.enqueueCommand(CanonRegistrationMessage(this)) + } + + @ExperimentalUnsignedTypes + private fun sendInitEventRequest(receiveData: ByteArray) + { + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_start_2), false, false, 0) + cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_start_2)) + try + { + var eventConnectionNumber: Int = receiveData[8].toUByte().toInt() and 0xff + eventConnectionNumber += (receiveData[9].toUByte().toInt() and 0xff shl 8) + eventConnectionNumber += (receiveData[10].toUByte().toInt() and 0xff shl 16) + eventConnectionNumber += (receiveData[11].toUByte().toInt() and 0xff shl 24) + statusChecker.setEventConnectionNumber(eventConnectionNumber) + interfaceProvider.cameraStatusWatcher.startStatusWatch(interfaceProvider.statusListener) + commandIssuer.enqueueCommand(PtpIpCommandGeneric(this, IPtpIpMessages.SEQ_OPEN_SESSION, isDumpLog, 0, 0x1002, 4, 0x41)) + } + catch (e: Exception) + { + e.printStackTrace() + } + } + + private fun checkRegistrationMessage(receiveData: ByteArray?): Boolean + { + // データ(Connection Number)がないときにはエラーと判断する + return !(receiveData == null || receiveData.size < 12) + } + + private fun checkEventInitialize(receiveData: ByteArray?): Boolean + { + Log.v(TAG, "checkEventInitialize() ") + return receiveData != null + } + + private fun connectFinished() + { + try + { + // 接続成功のメッセージを出す + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connected), false, false, 0) + + // ちょっと待つ + Thread.sleep(1000) + + // 接続成功!のメッセージを出す + interfaceProvider.informationReceiver.updateMessage(context.getString(R.string.connect_connected), false, false, 0) + onConnectNotify() + } + catch (e: Exception) + { + e.printStackTrace() + } + } + + private fun onConnectNotify() + { + try + { + val thread = Thread { + // カメラとの接続確立を通知する + cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connected)) + cameraStatusReceiver.onCameraConnected() + Log.v(TAG, " onConnectNotify()") + } + thread.start() + } + catch (e: Exception) + { + e.printStackTrace() + } + } + + companion object + { + private const val TAG = "CanonConnectSeq.1" + } +} diff --git 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 index 1c60471..3647d5c 100644 --- 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 @@ package net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.connection; import android.app.Activity; +import android.util.Log; import androidx.annotation.NonNull; @@ -29,6 +30,7 @@ class CanonCameraDisconnectSequence implements Runnable { try { + Log.v(TAG, " disconnect"); liveview.disconnect(); async.disconnect(); command.disconnect(); diff --git 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 index 8f1fa50..a708521 100644 --- 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 private final BroadcastReceiver connectionReceiver; private final Executor cameraExecutor = Executors.newFixedThreadPool(1); private final PtpIpStatusChecker statusChecker; + private final int sequenceType; private CameraConnectionStatus connectionStatus = CameraConnectionStatus.UNKNOWN; - public CanonConnection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IPtpIpInterfaceProvider interfaceProvider, @NonNull PtpIpStatusChecker statusChecker) + public CanonConnection(@NonNull final Activity context, @NonNull final ICameraStatusReceiver statusReceiver, @NonNull IPtpIpInterfaceProvider interfaceProvider, @NonNull PtpIpStatusChecker statusChecker, int sequenceType) { Log.v(TAG, "CanonConnection()"); this.context = context; this.statusReceiver = statusReceiver; this.interfaceProvider = interfaceProvider; this.statusChecker = statusChecker; + this.sequenceType = sequenceType; connectionReceiver = new BroadcastReceiver() { @Override @@ -204,7 +206,7 @@ public class CanonConnection implements ICameraConnection */ private void disconnectFromCamera(final boolean powerOff) { - Log.v(TAG, " disconnectFromCamera()"); + Log.v(TAG, " disconnectFromCamera() : " + powerOff); try { cameraExecutor.execute(new CanonCameraDisconnectSequence(context, interfaceProvider)); @@ -224,7 +226,16 @@ public class CanonConnection implements ICameraConnection connectionStatus = CameraConnectionStatus.CONNECTING; try { - cameraExecutor.execute(new CanonCameraConnectSequenceForPlayback(context, statusReceiver, this, interfaceProvider, statusChecker)); +/* + if (sequenceType == 1) + { + cameraExecutor.execute(new CanonCameraConnectSequenceForPlaybackType1(context, statusReceiver, this, interfaceProvider, statusChecker)); + } + else +*/ + { + cameraExecutor.execute(new CanonCameraConnectSequenceForPlayback(context, statusReceiver, this, interfaceProvider, statusChecker)); + } } catch (Exception e) { diff --git a/app/src/main/java/net/osdn/gokigen/pkremote/preference/IPreferencePropertyAccessor.java b/app/src/main/java/net/osdn/gokigen/pkremote/preference/IPreferencePropertyAccessor.java index 36de670..ccaaaf0 100644 --- 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 String THUMBNAIL_IMAGE_CACHE_SIZE = "thumbnail_image_cache_size"; String THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE = "120"; + String CANON_HOST_IP = "canon_host_ip"; + String CANON_HOST_IP_DEFAULT_VALUE = "192.168.0.1"; + + String CANON_CONNECTION_SEQUENCE = "canon_connection_mode"; + String CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE = "0"; + /* //String GR2_DISPLAY_MODE = "gr2_display_mode"; //String GR2_DISPLAY_MODE_DEFAULT_VALUE = "0"; diff --git 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 index ab6bb78..a42e2ee 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index fbb59ea..36028f4 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index 0535826..07967e8 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index 8932e4d..97b8e67 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } diff --git 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 index e0c7637..122b3bc 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index ae76169..4dc8f98 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index 31c343f..63d80bf 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index 570851b..d0d9392 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index 673d36f..53fdcea 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git 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 index 35b7e82..777f1f4 100644 --- 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 { editor.putString(IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE, IPreferencePropertyAccessor.THUMBNAIL_IMAGE_CACHE_SIZE_DEFAULT_VALUE); } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_HOST_IP)) { + editor.putString(IPreferencePropertyAccessor.CANON_HOST_IP, IPreferencePropertyAccessor.CANON_HOST_IP_DEFAULT_VALUE); + } + if (!items.containsKey(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE)) { + editor.putString(IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE, IPreferencePropertyAccessor.CANON_CONNECTION_SEQUENCE_DEFAULT_VALUE); + } editor.apply(); } catch (Exception e) diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index e07ddf7..fce3479 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -372,4 +372,10 @@ サムネイル画像キャッシュ数 小メモリ機の場合には、この値を減らしてください。(初期値:120) + カメラIPアドレス + 通常、変更は不要です (初期値:192.168.0.1) + + 接続シーケンス + 通常、変更は不要です (初期値: TYPE0) + diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 5c069ef..e08ec12 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -104,4 +104,16 @@ sd2 + + TYPE0 + TYPE1 + TYPE2 + + + + 0 + 1 + 2 + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 331b6b7..1276303 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -374,4 +374,10 @@ Thumbnail image cache size If you use low memory machine, please decrease this value.(default:120) + Camera IP Address + default: 192.168.0.1 + + Connection Sequence + default: TYPE0 + diff --git a/app/src/main/res/xml/preferences_canon.xml b/app/src/main/res/xml/preferences_canon.xml index 2725da3..7a2f31c 100644 --- a/app/src/main/res/xml/preferences_canon.xml +++ b/app/src/main/res/xml/preferences_canon.xml @@ -43,6 +43,20 @@ android:defaultValue="20" android:summary="@string/pref_summary_canon_receive_wait" /> + + + +