OSDN Git Service

次バージョンのための拡張を開始。
[gokigen/PKRemote.git] / app / src / main / java / net / osdn / gokigen / pkremote / camera / CameraInterfaceProvider.java
index 0467914..fa04c76 100644 (file)
@@ -25,12 +25,14 @@ import net.osdn.gokigen.pkremote.camera.utils.CameraStatusListener;
 import net.osdn.gokigen.pkremote.camera.vendor.fujix.wrapper.FujiXInterfaceProvider;
 import net.osdn.gokigen.pkremote.camera.vendor.olympus.IOlympusInterfaceProvider;
 import net.osdn.gokigen.pkremote.camera.vendor.olympus.wrapper.OlympusInterfaceProvider;
+import net.osdn.gokigen.pkremote.camera.vendor.olympuspen.wrapper.OlympusPenInterfaceProvider;
 import net.osdn.gokigen.pkremote.camera.vendor.panasonic.wrapper.PanasonicCameraWrapper;
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.IPtpIpInterfaceProvider;
+import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.PtpIpInterfaceProvider;
 import net.osdn.gokigen.pkremote.camera.vendor.ricoh.wrapper.RicohGr2InterfaceProvider;
 import net.osdn.gokigen.pkremote.camera.vendor.sony.ISonyInterfaceProvider;
 import net.osdn.gokigen.pkremote.camera.vendor.sony.wrapper.SonyCameraWrapper;
 import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
-import net.osdn.gokigen.pkremote.preference.panasonic.PanasonicPreferenceFragment;
 
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.AppCompatActivity;
@@ -47,6 +49,8 @@ public class CameraInterfaceProvider implements IInterfaceProvider
     private final RicohGr2InterfaceProvider ricohGr2;
     private final FujiXInterfaceProvider fujiX;
     private final PanasonicCameraWrapper panasonic;
+    private final PtpIpInterfaceProvider ptpip;
+    private final OlympusPenInterfaceProvider olympuspen;
     private final IInformationReceiver informationReceiver;
     private final CameraContentsRecognizer cameraContentsRecognizer;
     private final AppCompatActivity context;
@@ -70,7 +74,9 @@ public class CameraInterfaceProvider implements IInterfaceProvider
         ricohGr2 = new RicohGr2InterfaceProvider(context, provider);
         fujiX = new FujiXInterfaceProvider(context, provider, statusListener, informationReceiver);
         sony = new SonyCameraWrapper(context, provider, statusListener, informationReceiver);
-        panasonic = new PanasonicCameraWrapper(context, provider, statusListener);
+        ptpip = new PtpIpInterfaceProvider(context, provider, statusListener, informationReceiver);
+        panasonic = new PanasonicCameraWrapper(context, provider, statusListener, informationReceiver);
+        olympuspen = new OlympusPenInterfaceProvider(context, provider);
         this.informationReceiver = informationReceiver;
         this.cameraContentsRecognizer = new CameraContentsRecognizer(context, this);
     }
@@ -87,6 +93,12 @@ public class CameraInterfaceProvider implements IInterfaceProvider
         return (sony);
     }
 
+    @Override
+    public IPtpIpInterfaceProvider getPtpIpInterface()
+    {
+        return (ptpip);
+    }
+
     /**
      *
      *
@@ -113,6 +125,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getSonyCameraConnection());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getPtpIpCameraConnection());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getPtpIpCameraConnection());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getOlyCameraConnection());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getRicohGr2CameraConnection());
@@ -147,6 +171,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getButtonControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getButtonControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getButtonControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getButtonControl());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getButtonControl());
@@ -181,6 +217,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getDisplayInjector());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getDisplayInjector());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getDisplayInjector());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getDisplayInjector());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getDisplayInjector());
@@ -215,6 +263,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getLiveViewControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getLiveViewControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getLiveViewControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getLiveViewControl());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getLiveViewControl());
@@ -249,6 +309,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getLiveViewListener());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getLiveViewListener());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getLiveViewListener());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getLiveViewListener());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getLiveViewListener());
@@ -283,6 +355,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getFocusingControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getFocusingControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getFocusingControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getFocusingControl());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getFocusingControl());
@@ -317,6 +401,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getCameraInformation());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getCameraInformation());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getCameraInformation());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getCameraInformation());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getCameraInformation());
@@ -351,6 +447,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getZoomLensControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getZoomLensControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getZoomLensControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getZoomLensControl());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getZoomLensControl());
@@ -385,6 +493,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getCaptureControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getCaptureControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getCaptureControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getCaptureControl());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getCaptureControl());
@@ -419,6 +539,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getCameraStatusListHolder());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getCameraStatusListHolder());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getCameraStatusListHolder());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getCameraStatusListHolder());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getCameraStatusListHolder());
@@ -453,6 +585,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getCameraStatusWatcher());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getCameraStatusWatcher());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getCameraStatusWatcher());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getCameraStatusWatcher());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getCameraStatusWatcher());
@@ -487,6 +631,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getPlaybackControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getPlaybackControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getPlaybackControl());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getPlaybackControl());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getPlaybackControl());
@@ -521,6 +677,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getHardwareStatus());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getHardwareStatus());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getHardwareStatus());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getHardwareStatus());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getHardwareStatus());
@@ -555,6 +723,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (sony.getCameraRunMode());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.CANON)
+            {
+                return (ptpip.getCameraRunMode());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.NIKON)
+            {
+                return (ptpip.getCameraRunMode());
+            }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+            {
+                return (olympuspen.getCameraRunMode());
+            }
             else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH)
             {
                 return (ricohGr2.getCameraRunMode());
@@ -634,6 +814,18 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 ret = ICameraConnection.CameraConnectionMethod.SONY;
             }
+            else if (connectionMethod.contains("CANON"))
+            {
+                ret = ICameraConnection.CameraConnectionMethod.CANON;
+            }
+            else if (connectionMethod.contains("NIKON"))
+            {
+                ret = ICameraConnection.CameraConnectionMethod.NIKON;
+            }
+            else if (connectionMethod.contains("OLYMPUS"))
+            {
+                ret = ICameraConnection.CameraConnectionMethod.OLYMPUS;
+            }
             else // if (connectionMethod.contains("OPC"))
             {
                 ret = ICameraConnection.CameraConnectionMethod.OPC;