OSDN Git Service

次バージョンのための拡張を開始。
[gokigen/PKRemote.git] / app / src / main / java / net / osdn / gokigen / pkremote / camera / CameraInterfaceProvider.java
index a8d7ecb..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;
@@ -69,8 +73,10 @@ public class CameraInterfaceProvider implements IInterfaceProvider
         olympus = new OlympusInterfaceProvider(context, provider);
         ricohGr2 = new RicohGr2InterfaceProvider(context, provider);
         fujiX = new FujiXInterfaceProvider(context, provider, statusListener, informationReceiver);
-        sony = new SonyCameraWrapper(context, provider, statusListener);
-        panasonic = new PanasonicCameraWrapper(context, provider, statusListener);
+        sony = new SonyCameraWrapper(context, provider, statusListener, informationReceiver);
+        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);
+    }
+
     /**
      *
      *
@@ -109,6 +121,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getPanasonicCameraConnection());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -139,6 +167,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getButtonControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -169,6 +213,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getDisplayInjector());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -199,6 +259,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getPanasonicLiveViewControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -229,6 +305,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getLiveViewListener());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -259,6 +351,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getFocusingControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -289,6 +397,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getCameraInformation());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -319,6 +443,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getZoomLensControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -349,6 +489,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getCaptureControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -379,6 +535,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getCameraStatusListHolder());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -409,6 +581,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getCameraStatusWatcher());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -439,6 +627,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getPlaybackControl());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -469,6 +673,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getHardwareStatus());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -499,6 +719,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 return (panasonic.getCameraRunMode());
             }
+            else if (connectionMethod == ICameraConnection.CameraConnectionMethod.SONY)
+            {
+                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());
@@ -574,6 +810,22 @@ public class CameraInterfaceProvider implements IInterfaceProvider
             {
                 ret = ICameraConnection.CameraConnectionMethod.PANASONIC;
             }
+            else if (connectionMethod.contains("SONY"))
+            {
+                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;