OSDN Git Service

とりあえず、Power Shot Zoomから画像をダウンロードできるところまで。
authorMRSa <mrsa@myad.jp>
Wed, 30 Dec 2020 14:17:48 +0000 (23:17 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 30 Dec 2020 14:17:48 +0000 (23:17 +0900)
19 files changed:
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/PtpIpInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraConnectSequenceForPlaybackType1.kt [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonCameraDisconnectSequence.java
app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/ptpip/wrapper/connection/CanonConnection.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/IPreferencePropertyAccessor.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/canon/CanonPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/fujix/FujiXPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/nikon/NikonPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/olympus/OpcPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/olympuspen/OlympusPenPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/panasonic/PanasonicPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/pixpro/PixproPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/ricohgr2/RicohGr2PreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/sony/SonyPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/pkremote/preference/theta/ThetaPreferenceFragment.java
app/src/main/res/values-ja/strings.xml
app/src/main/res/values/arrays.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences_canon.xml

index eb9cf2c..bc08cf8 100644 (file)
@@ -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 (file)
index 0000000..72ea1d8
--- /dev/null
@@ -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"
+    }
+}
index 1c60471..3647d5c 100644 (file)
@@ -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();
index 8f1fa50..a708521 100644 (file)
@@ -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)
         {
index 36de670..ccaaaf0 100644 (file)
@@ -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";
index ab6bb78..a42e2ee 100644 (file)
@@ -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)
index fbb59ea..36028f4 100644 (file)
@@ -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)
index 0535826..07967e8 100644 (file)
@@ -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)
index 8932e4d..97b8e67 100644 (file)
@@ -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();
     }
 
index e0c7637..122b3bc 100644 (file)
@@ -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)
index ae76169..4dc8f98 100644 (file)
@@ -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)
index 31c343f..63d80bf 100644 (file)
@@ -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)
index 570851b..d0d9392 100644 (file)
@@ -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)
index 673d36f..53fdcea 100644 (file)
@@ -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)
index 35b7e82..777f1f4 100644 (file)
@@ -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)
index e07ddf7..fce3479 100644 (file)
     <string name="pref_thumbnail_image_cache_size">サムネイル画像キャッシュ数</string>
     <string name="pref_summary_thumbnail_image_cache_size">小メモリ機の場合には、この値を減らしてください。(初期値:120)</string>
 
+    <string name="pref_canon_host_ip">カメラIPアドレス</string>
+    <string name="pref_summary_canon_host_ip">通常、変更は不要です (初期値:192.168.0.1)</string>
+
+    <string name="pref_canon_connection_mode">接続シーケンス</string>
+    <string name="pref_summary_canon_connection_mode">通常、変更は不要です (初期値: TYPE0)</string>
+
 </resources>
index 5c069ef..e08ec12 100644 (file)
         <item>sd2</item>
     </string-array>
 
+    <string-array name="canon_connection_mode">
+        <item>TYPE0</item>
+        <item>TYPE1</item>
+        <item>TYPE2</item>
+    </string-array>
+
+    <string-array name="canon_connection_mode_value">
+        <item>0</item>
+        <item>1</item>
+        <item>2</item>
+    </string-array>
+
 </resources>
index 331b6b7..1276303 100644 (file)
     <string name="pref_thumbnail_image_cache_size">Thumbnail image cache size</string>
     <string name="pref_summary_thumbnail_image_cache_size">If you use low memory machine, please decrease this value.(default:120)</string>
 
+    <string name="pref_canon_host_ip">Camera IP Address</string>
+    <string name="pref_summary_canon_host_ip">default: 192.168.0.1 </string>
+
+    <string name="pref_canon_connection_mode">Connection Sequence</string>
+    <string name="pref_summary_canon_connection_mode">default: TYPE0 </string>
+
 </resources>
index 2725da3..7a2f31c 100644 (file)
             android:defaultValue="20"
             android:summary="@string/pref_summary_canon_receive_wait" />
 
+        <EditTextPreference
+            android:key="canon_host_ip"
+            android:title="@string/pref_canon_host_ip"
+            android:defaultValue="192.168.0.1"
+            android:summary="@string/pref_summary_canon_host_ip" />
+
+        <ListPreference
+            android:title="@string/pref_canon_connection_mode"
+            android:summary="@string/pref_summary_canon_connection_mode"
+            android:entryValues="@array/canon_connection_mode_value"
+            android:entries="@array/canon_connection_mode"
+            android:key="canon_connection_mode"
+            android:defaultValue="0"/>
+
         <!--
 
         <PreferenceScreen