import net.osdn.gokigen.a01d.preference.olympuspen.OlympusPreferenceFragment;
import net.osdn.gokigen.a01d.preference.ricohgr2.RicohGr2PreferenceFragment;
import net.osdn.gokigen.a01d.preference.sony.SonyPreferenceFragment;
+import net.osdn.gokigen.a01d.preference.theta.ThetaPreferenceFragment;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
e.printStackTrace();
}
}
+ else if (method == ICameraConnection.CameraConnectionMethod.THETA)
+ {
+ try
+ {
+ // THETA の場合は、HTTPコマンド送信ダイアログを表示する
+ SimpleHttpSendCommandDialog.newInstance("http://192.168.1.1/", null, null).show(getSupportFragmentManager(), "thetaSendCommandDialog");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
else
{
// OPC カメラの場合...
preferenceFragment = OlympusPreferenceFragment.newInstance(this, this);
} else if (connectionMethod == ICameraConnection.CameraConnectionMethod.FUJI_X) {
preferenceFragment = FujiXPreferenceFragment.newInstance(this, this);
+ } else if (connectionMethod == ICameraConnection.CameraConnectionMethod.THETA) {
+ preferenceFragment = ThetaPreferenceFragment.newInstance(this, this);
} else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
preferenceFragment = PreferenceFragment.newInstance(this, interfaceProvider, this);
{
connection = interfaceProvider.getOlympusPenInterface().getOlyCameraConnection();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.THETA)
+ {
+ connection = interfaceProvider.getThetaInterface().getCameraConnection();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
connection = interfaceProvider.getOlympusInterface().getOlyCameraConnection();
import net.osdn.gokigen.a01d.camera.ricohgr2.wrapper.RicohGr2InterfaceProvider;
import net.osdn.gokigen.a01d.camera.sony.ISonyInterfaceProvider;
import net.osdn.gokigen.a01d.camera.sony.wrapper.SonyCameraWrapper;
+import net.osdn.gokigen.a01d.camera.theta.IThetaInterfaceProvider;
+import net.osdn.gokigen.a01d.camera.theta.wrapper.ThetaInterfaceProvider;
import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
private final RicohGr2InterfaceProvider ricohGr2;
private final FujiXInterfaceProvider fujiX;
private final PanasonicCameraWrapper panasonic;
+ private final ThetaInterfaceProvider theta;
private final CameraStatusListener statusListener;
public CameraInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
fujiX = new FujiXInterfaceProvider(context, provider, statusListener);
panasonic = new PanasonicCameraWrapper(context, provider, statusListener);
ricohGr2 = new RicohGr2InterfaceProvider(context, provider);
+ theta = new ThetaInterfaceProvider(context, provider, statusListener);
}
@Override
return (olympusPen);
}
+ @Override
+ public IThetaInterfaceProvider getThetaInterface()
+ {
+ return (theta);
+ }
+
/**
* OPCカメラを使用するかどうか
*
{
ret = ICameraConnection.CameraConnectionMethod.OLYMPUS;
}
+ else if (connectionMethod.contains("THETA"))
+ {
+ ret = ICameraConnection.CameraConnectionMethod.THETA;
+ }
}
catch (Exception e)
{
FUJI_X,
PANASONIC,
OLYMPUS,
+ THETA,
}
enum CameraConnectionStatus
import net.osdn.gokigen.a01d.camera.panasonic.IPanasonicInterfaceProvider;
import net.osdn.gokigen.a01d.camera.ricohgr2.IRicohGr2InterfaceProvider;
import net.osdn.gokigen.a01d.camera.sony.ISonyInterfaceProvider;
+import net.osdn.gokigen.a01d.camera.theta.IThetaInterfaceProvider;
import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
import androidx.annotation.NonNull;
IOlympusPenInterfaceProvider getOlympusPenInterface();
+ IThetaInterfaceProvider getThetaInterface();
+
void setUpdateReceiver(@NonNull ICameraStatusUpdateNotify receiver);
ICameraConnection.CameraConnectionMethod getCammeraConnectionMethod();
--- /dev/null
+package net.osdn.gokigen.a01d.camera.theta.operation;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.camera.theta.wrapper.IThetaSessionIdProvider;
+import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
+import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
+import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
+import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
+
+public class ThetaSingleShotControl
+{
+ private final String TAG = toString();
+ private final IThetaSessionIdProvider sessionIdProvider;
+ private final IAutoFocusFrameDisplay frameDisplayer;
+ private boolean useThetaV21 = false;
+ private int timeoutMs = 6000;
+
+
+ public ThetaSingleShotControl(@NonNull Context context, @NonNull final IThetaSessionIdProvider sessionIdProvider, @NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull IIndicatorControl indicator)
+ {
+ this.sessionIdProvider = sessionIdProvider;
+ this.frameDisplayer = frameDisplayer;
+ try
+ {
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+ useThetaV21 = preferences.getBoolean(IPreferencePropertyAccessor.USE_OSC_THETA_V21, false);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ Log.v(TAG, "USE THETA WEB API V2.1 (OSC V2) : " + useThetaV21);
+ }
+
+
+ /**
+ *
+ *
+ */
+ public void singleShot()
+ {
+ Log.v(TAG, "singleShot()");
+ try
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ String shootUrl = "http://192.168.1.1/osc/commands/execute";
+ String postData = (useThetaV21) ? "{\"name\":\"camera.takePicture\",\"parameters\":{\"timeout\":0}}" : "{\"name\":\"camera.takePicture\",\"parameters\":{\"sessionId\": \"" + sessionIdProvider.getSessionId() + "\"}}";
+ String result = SimpleHttpClient.httpPost(shootUrl, postData, timeoutMs);
+ if ((result == null)||(result.length() < 1))
+ {
+ Log.v(TAG, "singleShot() reply is null.");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ frameDisplayer.hideFocusFrame();
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
package net.osdn.gokigen.a01d.camera.theta.wrapper;
+import android.content.Context;
import android.util.Log;
import androidx.annotation.NonNull;
import net.osdn.gokigen.a01d.camera.panasonic.operation.PanasonicCameraCaptureControl;
import net.osdn.gokigen.a01d.camera.panasonic.operation.takepicture.SingleShotControl;
import net.osdn.gokigen.a01d.camera.panasonic.wrapper.IPanasonicCamera;
+import net.osdn.gokigen.a01d.camera.theta.operation.ThetaSingleShotControl;
import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
public class ThetaCaptureControl implements ICaptureControl
{
- private static final String TAG = PanasonicCameraCaptureControl.class.getSimpleName();
- //private final OlympusPenSingleShotControl singleShotControl;
+ private static final String TAG = ThetaCaptureControl.class.getSimpleName();
+ private final ThetaSingleShotControl singleShotControl;
- public ThetaCaptureControl(@NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull IIndicatorControl indicator)
+ public ThetaCaptureControl(@NonNull Context context, @NonNull final IThetaSessionIdProvider sessionIdProvider, @NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull IIndicatorControl indicator)
{
- //singleShotControl = new OlympusPenSingleShotControl(frameDisplayer, indicator);
+ singleShotControl = new ThetaSingleShotControl(context, sessionIdProvider, frameDisplayer, indicator);
}
/**
Log.v(TAG, "doCapture() : " + kind);
try
{
- //singleShotControl.singleShot();
+ singleShotControl.singleShot();
}
catch (Exception e)
{
public class ThetaInterfaceProvider implements IThetaInterfaceProvider, IDisplayInjector, IThetaSessionIdNotifier, IThetaSessionIdProvider
{
private final String TAG = toString();
+ private final Activity activity;
private final ThetaConnection thetaConnection;
private final ThetaHardwareStatus hardwareStatus;
private final ThetaRunMode runMode;
e.printStackTrace();
}
*/
- //this.activity = context;
+ this.activity = context;
//this.provider = provider;
this.statusListener = statusListener;
thetaConnection = new ThetaConnection(context, provider, this);
{
Log.v(TAG, "injectDisplay()");
focusControl = new ThetaFocusControl(frameDisplayer);
- captureControl = new ThetaCaptureControl(frameDisplayer, indicator);
+ captureControl = new ThetaCaptureControl(activity, this, frameDisplayer, indicator);
}
@Override
this.cameraConnection = interfaceProvider.getOlympusPenInterface().getOlyCameraConnection();
this.zoomLensControl = interfaceProvider.getOlympusPenInterface().getZoomLensControl();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.THETA)
+ {
+ this.focusingControl = interfaceProvider.getThetaInterface().getFocusingControl();
+ this.captureControl = interfaceProvider.getThetaInterface().getCaptureControl();
+ this.propertyProvider = interfaceProvider.getOlympusInterface().getCameraPropertyProvider(); // 要変更
+ this.cameraInformation = interfaceProvider.getThetaInterface().getCameraInformation();
+ this.cameraConnection = interfaceProvider.getThetaInterface().getCameraConnection();
+ this.zoomLensControl = interfaceProvider.getThetaInterface().getZoomLensControl();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
this.focusingControl = interfaceProvider.getOlympusInterface().getFocusingControl();
changeLiveViewScale.setVisibility(View.INVISIBLE);
}
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.THETA)
+ {
+ if (favoriteButton != null)
+ {
+ favoriteButton.setVisibility(View.VISIBLE);
+ favoriteButton.setOnClickListener(onClickTouchListener);
+ }
+ if (manualFocus != null)
+ {
+ manualFocus.setVisibility(View.INVISIBLE);
+ }
+ if (changeLiveViewScale != null)
+ {
+ changeLiveViewScale.setVisibility(View.INVISIBLE);
+ }
+ if (focusIndicator != null)
+ {
+ focusIndicator.setVisibility(View.INVISIBLE);
+ }
+ if (propertyButton != null)
+ {
+ propertyButton.setOnClickListener(onClickTouchListener);
+ }
+ }
}
if (manualFocus != null)
{
{
interfaceInjector = interfaceProvider.getOlympusPenInterface().getDisplayInjector();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.THETA)
+ {
+ interfaceInjector = interfaceProvider.getThetaInterface().getDisplayInjector();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
interfaceInjector = interfaceProvider.getOlympusInterface().getDisplayInjector();
this.zoomLensControl = interfaceProvider.getOlympusPenInterface().getZoomLensControl();
this.cameraInformation = interfaceProvider.getOlympusPenInterface().getCameraInformation();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.THETA)
+ {
+ this.liveViewControl = interfaceProvider.getThetaInterface().getLiveViewControl();
+ this.zoomLensControl = interfaceProvider.getThetaInterface().getZoomLensControl();
+ this.cameraInformation = interfaceProvider.getThetaInterface().getCameraInformation();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
this.liveViewControl = interfaceProvider.getOlympusInterface().getLiveViewControl();
{
lvListener = interfaceProvider.getOlympusPenInterface().getLiveViewListener();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.THETA)
+ {
+ lvListener = interfaceProvider.getThetaInterface().getLiveViewListener();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
interfaceProvider.getOlympusLiveViewListener().setOlympusLiveViewListener(liveViewListener);
if (!items.containsKey(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW)) {
editor.putBoolean(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, true);
}
+ if (!items.containsKey(IPreferencePropertyAccessor.USE_OSC_THETA_V21)) {
+ editor.putBoolean(IPreferencePropertyAccessor.USE_OSC_THETA_V21, false);
+ }
if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD)) {
editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
}
Log.v(TAG, " " + key + " , " + value);
break;
+ case IPreferencePropertyAccessor.USE_OSC_THETA_V21:
+ value = preferences.getBoolean(key, false);
+ Log.v(TAG, " " + key + " , " + value);
+ break;
+
default:
String strValue = preferences.getString(key, "");
setListPreference(key, key, strValue);
try
{
//super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.preferences_olympuspen);
+ addPreferencesFromResource(R.xml.preferences_theta);
ListPreference connectionMethod = findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD);
connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
// Preferenceの画面に反映させる
setBooleanPreference(IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, IPreferencePropertyAccessor.AUTO_CONNECT_TO_CAMERA, defaultValue);
setBooleanPreference(IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, IPreferencePropertyAccessor.CAPTURE_BOTH_CAMERA_AND_LIVE_VIEW, defaultValue);
+ setBooleanPreference(IPreferencePropertyAccessor.USE_OSC_THETA_V21, IPreferencePropertyAccessor.USE_OSC_THETA_V21, false);
}
catch (Exception e)
{
<item >Olympus Pen/OM-D</item>
<item >Sony</item>
<item >Ricoh GR Series / PENTAX</item>
+ <item >Ricoh THETA Series</item>
<item >Fuji X Series</item>
<item >Panasonic</item>
</string-array>
<item >OLYMPUS</item>
<item >SONY</item>
<item >RICOH_GR2</item>
+ <item >THETA</item>
<item >FUJI_X</item>
<item >PANASONIC</item>
</string-array>
<item >Olympus Pen/OM-D</item>
<item >Sony</item>
<item >Ricoh GR Series / PENTAX</item>
+ <item >Ricoh THETA Series</item>
<item >Fuji X Series</item>
<item >Panasonic</item>
</string-array>
<item >OLYMPUS</item>
<item >SONY</item>
<item >RICOH_GR2</item>
+ <item >THETA</item>
<item >FUJI_X</item>
<item >PANASONIC</item>
</string-array>