1 package net.osdn.gokigen.pkremote.camera.vendor.olympuspen.wrapper;
3 import android.app.Activity;
4 import android.content.SharedPreferences;
6 import android.util.Log;
8 import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraButtonControl;
9 import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraConnection;
10 import net.osdn.gokigen.pkremote.camera.interfaces.control.ICameraRunMode;
11 import net.osdn.gokigen.pkremote.camera.interfaces.control.ICaptureControl;
12 import net.osdn.gokigen.pkremote.camera.interfaces.control.IFocusingControl;
13 import net.osdn.gokigen.pkremote.camera.interfaces.control.IFocusingModeNotify;
14 import net.osdn.gokigen.pkremote.camera.interfaces.control.IZoomLensControl;
15 import net.osdn.gokigen.pkremote.camera.interfaces.liveview.IAutoFocusFrameDisplay;
16 import net.osdn.gokigen.pkremote.camera.interfaces.liveview.IDisplayInjector;
17 import net.osdn.gokigen.pkremote.camera.interfaces.liveview.IIndicatorControl;
18 import net.osdn.gokigen.pkremote.camera.interfaces.liveview.ILiveViewControl;
19 import net.osdn.gokigen.pkremote.camera.interfaces.liveview.ILiveViewListener;
20 import net.osdn.gokigen.pkremote.camera.interfaces.playback.IPlaybackControl;
21 import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraHardwareStatus;
22 import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraInformation;
23 import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatus;
24 import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusReceiver;
25 import net.osdn.gokigen.pkremote.camera.interfaces.status.ICameraStatusWatcher;
26 import net.osdn.gokigen.pkremote.camera.vendor.olympuspen.IOlympusPenInterfaceProvider;
27 import net.osdn.gokigen.pkremote.camera.vendor.olympuspen.wrapper.connection.OlympusPenConnection;
28 import net.osdn.gokigen.pkremote.camera.vendor.olympuspen.wrapper.hardware.OlympusPenButtonControl;
29 import net.osdn.gokigen.pkremote.camera.vendor.olympuspen.wrapper.hardware.OlympusPenHardwareStatus;
30 import net.osdn.gokigen.pkremote.camera.vendor.olympuspen.wrapper.playback.OlympusPenPlaybackControl;
31 import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
33 import androidx.annotation.NonNull;
34 import androidx.preference.PreferenceManager;
40 public class OlympusPenInterfaceProvider implements IOlympusPenInterfaceProvider, IDisplayInjector
42 private final String TAG = toString();
43 //private final Activity activity;
44 //private final ICameraStatusReceiver provider;
45 private final OlympusPenConnection olympusPenConnection;
46 private final OlympusPenButtonControl buttonControl;
47 private final OlympusPenPlaybackControl playbackControl;
48 private final OlympusPenHardwareStatus hardwareStatus;
49 private final OlympusPenRunMode runMode;
55 public OlympusPenInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
57 SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
58 //useGrCommand = preferences.getBoolean(IPreferencePropertyAccessor.USE_GR2_SPECIAL_COMMAND, true);
59 //pentaxCaptureAfterAf = preferences.getBoolean(IPreferencePropertyAccessor.PENTAX_CAPTURE_AFTER_AF, false);
60 int communicationTimeoutMs = 10000; // デフォルトは 10000ms とする
63 communicationTimeoutMs = Integer.parseInt(preferences.getString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT_DEFAULT_VALUE)) * 1000;
64 if (communicationTimeoutMs < 3000)
66 communicationTimeoutMs = 3000; // 最小値は 3000msとする。
73 int maxCount = 3000; // デフォルトは 3000枚 とする
76 maxCount = Integer.parseInt(preferences.getString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_MAX_COUNT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_MAX_COUNT_DEFAULT_VALUE));
79 maxCount = 300; // 最小値は 300枚とする。
87 //this.activity = context;
88 //this.provider = provider;
89 olympusPenConnection = new OlympusPenConnection(context, provider);
90 //liveViewControl = new RicohGr2LiveViewControl(useGrCommand);
91 //zoomControl = new RicohGr2CameraZoomLensControl();
92 buttonControl = new OlympusPenButtonControl();
93 //statusChecker = new RicohGr2StatusChecker(500, useGrCommand);
94 playbackControl = new OlympusPenPlaybackControl(communicationTimeoutMs);
95 hardwareStatus = new OlympusPenHardwareStatus();
96 runMode = new OlympusPenRunMode();
101 Log.v(TAG, "prepare()");
105 public void injectDisplay(IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator, IFocusingModeNotify focusingModeNotify)
107 Log.v(TAG, "injectDisplay()");
108 //focusControl = new RicohGr2CameraFocusControl(useGrCommand, frameDisplayer, indicator);
109 //captureControl = new RicohGr2CameraCaptureControl(useGrCommand, pentaxCaptureAfterAf, frameDisplayer, statusChecker);
113 public ICameraConnection getOlyCameraConnection()
115 return (olympusPenConnection);
119 public ILiveViewControl getLiveViewControl()
125 public ILiveViewListener getLiveViewListener()
131 public IFocusingControl getFocusingControl()
137 public ICameraInformation getCameraInformation()
143 public IZoomLensControl getZoomLensControl()
149 public ICaptureControl getCaptureControl()
155 public IDisplayInjector getDisplayInjector() {
160 public ICameraStatus getCameraStatusListHolder()
166 public ICameraButtonControl getButtonControl()
168 return (buttonControl);
172 public ICameraStatusWatcher getCameraStatusWatcher() {
177 public IPlaybackControl getPlaybackControl()
179 return (playbackControl);
183 public ICameraHardwareStatus getHardwareStatus()
185 return (hardwareStatus);
189 public ICameraRunMode getCameraRunMode()