e.printStackTrace();
}
}
+ else if (method == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+ {
+ try
+ {
+ // Olympus Penの場合は、コマンド送信ダイアログを表示する
+ //FujiXCameraCommandSendDialog.newInstance(interfaceProvider.getFujiXInterface()).show(getSupportFragmentManager(), "sendCommandDialog");
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
else
{
// OPC カメラの場合...
{
connection = interfaceProvider.getFujiXInterface().getFujiXCameraConnection();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+ {
+ connection = interfaceProvider.getOlympusPenInterface().getOlyCameraConnection();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
connection = interfaceProvider.getOlympusInterface().getOlyCameraConnection();
import net.osdn.gokigen.a01d.camera.olympus.wrapper.IOlympusLiveViewListener;
import net.osdn.gokigen.a01d.camera.olympus.IOlympusInterfaceProvider;
import net.osdn.gokigen.a01d.camera.olympus.wrapper.OlympusInterfaceProvider;
+import net.osdn.gokigen.a01d.camera.olympuspen.IOlympusPenInterfaceProvider;
+import net.osdn.gokigen.a01d.camera.olympuspen.wrapper.OlympusPenInterfaceProvider;
import net.osdn.gokigen.a01d.camera.panasonic.IPanasonicInterfaceProvider;
import net.osdn.gokigen.a01d.camera.panasonic.wrapper.PanasonicCameraWrapper;
import net.osdn.gokigen.a01d.camera.ricohgr2.IRicohGr2InterfaceProvider;
{
private final Activity context;
private final OlympusInterfaceProvider olympus;
+ private final OlympusPenInterfaceProvider olympusPen;
private final SonyCameraWrapper sony;
private final RicohGr2InterfaceProvider ricohGr2;
private final FujiXInterfaceProvider fujiX;
this.context = context;
this.statusListener = new CameraStatusListener();
olympus = new OlympusInterfaceProvider(context, provider);
+ olympusPen = new OlympusPenInterfaceProvider(context, provider);
sony = new SonyCameraWrapper(context, provider, statusListener);
fujiX = new FujiXInterfaceProvider(context, provider, statusListener);
panasonic = new PanasonicCameraWrapper(context, provider, statusListener);
return (panasonic);
}
+ @Override
+ public IOlympusPenInterfaceProvider getOlympusPenInterface()
+ {
+ return (olympusPen);
+ }
+
/**
* OPCカメラを使用するかどうか
*
import net.osdn.gokigen.a01d.camera.fujix.IFujiXInterfaceProvider;
import net.osdn.gokigen.a01d.camera.olympus.wrapper.IOlympusLiveViewListener;
import net.osdn.gokigen.a01d.camera.olympus.IOlympusInterfaceProvider;
+import net.osdn.gokigen.a01d.camera.olympuspen.IOlympusPenInterfaceProvider;
import net.osdn.gokigen.a01d.camera.panasonic.IPanasonicInterfaceProvider;
import net.osdn.gokigen.a01d.camera.ricohgr2.IRicohGr2InterfaceProvider;
import net.osdn.gokigen.a01d.camera.sony.ISonyInterfaceProvider;
IFujiXInterfaceProvider getFujiXInterface();
IPanasonicInterfaceProvider getPanasonicInterface();
+ IOlympusPenInterfaceProvider getOlympusPenInterface();
+
void setUpdateReceiver(@NonNull ICameraStatusUpdateNotify receiver);
ICameraConnection.CameraConnectionMethod getCammeraConnectionMethod();
if (!interfaceProvider.getCommandCommunication().connect())
{
// 接続失敗...
- onConnectError(context.getString(R.string.dialog_title_connect_failed));
+ onConnectError(context.getString(R.string.dialog_title_connect_failed_fuji));
return;
}
}
// 接続失敗...
if (cameraStatusReceiver != null)
{
- cameraStatusReceiver.onStatusNotify(context.getString(R.string.dialog_title_connect_failed));
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.dialog_title_connect_failed_fuji));
}
- onConnectError(context.getString(R.string.dialog_title_connect_failed));
+ onConnectError(context.getString(R.string.dialog_title_connect_failed_fuji));
return;
}
}
e.printStackTrace();
if (cameraStatusReceiver != null)
{
- cameraStatusReceiver.onStatusNotify(context.getString(R.string.dialog_title_connect_failed));
+ cameraStatusReceiver.onStatusNotify(context.getString(R.string.dialog_title_connect_failed_fuji));
}
onConnectError(e.getLocalizedMessage());
}
}
else
{
- onConnectError(context.getString(R.string.connect_error_message));
+ onConnectError(context.getString(R.string.connect_error_message_fuji));
}
break;
{
cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connecting9));
}
- commandIssuer.enqueueCommand(new ChangeToPlayback2nd(this));
+ //commandIssuer.enqueueCommand(new ChangeToPlayback2nd(this));
+ commandIssuer.enqueueCommand(new StatusRequestMessage(this));
break;
case SEQ_CHANGE_TO_PLAYBACK_2ND:
if (!interfaceProvider.getCommandCommunication().connect())
{
// 接続失敗...
- onConnectError(context.getString(R.string.dialog_title_connect_failed));
+ onConnectError(context.getString(R.string.dialog_title_connect_failed_fuji));
return;
}
}
{
Log.v(TAG, "alertConnectingFailed() : " + message);
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setTitle(context.getString(R.string.dialog_title_connect_failed))
+ .setTitle(context.getString(R.string.dialog_title_connect_failed_fuji))
.setMessage(message)
.setPositiveButton(context.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
@Override
public void alertConnectingFailed(String message)
{
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setTitle(context.getString(R.string.dialog_title_connect_failed))
+ .setTitle(context.getString(R.string.dialog_title_connect_failed_opc))
.setMessage(message)
.setPositiveButton(context.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
@Override
import net.osdn.gokigen.a01d.camera.IZoomLensControl;
import net.osdn.gokigen.a01d.camera.olympus.wrapper.ICameraHardwareStatus;
import net.osdn.gokigen.a01d.camera.olympus.wrapper.ICameraRunMode;
+import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener;
/**
IZoomLensControl getZoomLensControl();
ICaptureControl getCaptureControl();
IDisplayInjector getDisplayInjector();
+ IOlyCameraPropertyProvider getCameraPropertyProvider();
ICameraStatus getCameraStatusListHolder();
ICameraStatusWatcher getCameraStatusWatcher();
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.operation;
+
+import android.graphics.PointF;
+import android.graphics.RectF;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.camera.panasonic.operation.takepicture.PanasonicAutoFocusControl;
+import net.osdn.gokigen.a01d.camera.panasonic.wrapper.IPanasonicCamera;
+import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
+import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
+import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+public class OlympusPenAutoFocusControl
+{
+ private static final String TAG = PanasonicAutoFocusControl.class.getSimpleName();
+ private static final int TIMEOUT_MS = 3000;
+ private final IIndicatorControl indicator;
+ private final IAutoFocusFrameDisplay frameDisplayer;
+ //private IPanasonicCamera camera = null;
+
+ /**
+ *
+ *
+ */
+ public OlympusPenAutoFocusControl(@NonNull final IAutoFocusFrameDisplay frameDisplayer, final IIndicatorControl indicator)
+ {
+ this.frameDisplayer = frameDisplayer;
+ this.indicator = indicator;
+ }
+
+ /**
+ *
+ *
+ */
+ public void setCamera(@NonNull IPanasonicCamera panasonicCamera)
+ {
+ //this.camera = panasonicCamera;
+ }
+
+ /**
+ *
+ *
+ */
+ public void lockAutoFocus(@NonNull final PointF point)
+ {
+ Log.v(TAG, "lockAutoFocus() : [" + point.x + ", " + point.y + "]");
+/*
+ if (camera == null)
+ {
+ Log.v(TAG, "ISonyCameraApi is null...");
+ return;
+ }
+*/
+ try
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ RectF preFocusFrameRect = getPreFocusFrameRect(point);
+ try
+ {
+ showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Running, 0.0);
+
+ int posX = (int) (Math.floor(point.x * 1000.0));
+ int posY = (int) (Math.floor(point.y * 1000.0));
+ Log.v(TAG, "AF (" + posX + ", " + posY + ")");
+/*
+ //String reply = SimpleHttpClient.httpGet(camera.getCmdUrl() + "cam.cgi?mode=camctrl&type=touch&value=" + posX + "/" + posY + "&value2=on", TIMEOUT_MS);
+
+ if (!reply.contains("ok"))
+ {
+ Log.v(TAG, "setTouchAFPosition() reply is null.");
+ }
+*/
+/*
+ if (findTouchAFPositionResult(resultsObj))
+ {
+ // AF FOCUSED
+ Log.v(TAG, "lockAutoFocus() : FOCUSED");
+ showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Focused, 0.0);
+ }
+ else
+ {
+ // AF ERROR
+ Log.v(TAG, "lockAutoFocus() : ERROR");
+ showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Failed, 1.0);
+ }
+*/
+ showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Errored, 1.0);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ try
+ {
+ showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Errored, 1.0);
+ }
+ catch (Exception ee)
+ {
+ ee.printStackTrace();
+ }
+ }
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * シャッター半押し処理
+ *
+ */
+ public void halfPressShutter(final boolean isPressed)
+ {
+ Log.v(TAG, "halfPressShutter() : " + isPressed);
+/*
+ if (camera == null)
+ {
+ Log.v(TAG, "IPanasonicCamera is null...");
+ return;
+ }
+*/
+ try
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ String status = (isPressed) ? "on" : "off";
+/*
+ String reply = SimpleHttpClient.httpGet(camera.getCmdUrl() + "cam.cgi?mode=camctrl&type=touch&value=500/500&value2=" + status, TIMEOUT_MS);
+ if (!reply.contains("ok"))
+ {
+ Log.v(TAG, "CENTER FOCUS (" + status + ") FAIL...");
+ }
+ else
+ {
+ indicator.onAfLockUpdate(isPressed);
+ }
+*/
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ public void unlockAutoFocus()
+ {
+ Log.v(TAG, "unlockAutoFocus()");
+/*
+ if (camera == null)
+ {
+ Log.v(TAG, "IPanasonicCamera is null...");
+ return;
+ }
+*/
+ try
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+/*
+ String reply = SimpleHttpClient.httpGet(camera.getCmdUrl() + "cam.cgi?mode=camctrl&type=touch&value=500/500&value2=off", TIMEOUT_MS);
+ if (!reply.contains("ok"))
+ {
+ Log.v(TAG, "CENTER FOCUS (UNLOCK) FAIL...");
+ }
+*/
+ hideFocusFrame();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ private void showFocusFrame(RectF rect, IAutoFocusFrameDisplay.FocusFrameStatus status, double duration)
+ {
+ frameDisplayer.showFocusFrame(rect, status, duration);
+ indicator.onAfLockUpdate(IAutoFocusFrameDisplay.FocusFrameStatus.Focused == status);
+ }
+
+ /**
+ *
+ *
+ */
+ private void hideFocusFrame()
+ {
+ frameDisplayer.hideFocusFrame();
+ indicator.onAfLockUpdate(false);
+ }
+
+ /**
+ *
+ *
+ */
+ private RectF getPreFocusFrameRect(@NonNull PointF point)
+ {
+ float imageWidth = frameDisplayer.getContentSizeWidth();
+ float imageHeight = frameDisplayer.getContentSizeHeight();
+
+ // Display a provisional focus frame at the touched point.
+ float focusWidth = 0.125f; // 0.125 is rough estimate.
+ float focusHeight = 0.125f;
+ if (imageWidth > imageHeight)
+ {
+ focusHeight *= (imageWidth / imageHeight);
+ }
+ else
+ {
+ focusHeight *= (imageHeight / imageWidth);
+ }
+ return (new RectF(point.x - focusWidth / 2.0f, point.y - focusHeight / 2.0f,
+ point.x + focusWidth / 2.0f, point.y + focusHeight / 2.0f));
+ }
+
+ /**
+ *
+ *
+ */
+ private static boolean findTouchAFPositionResult(JSONObject replyJson)
+ {
+ boolean afResult = false;
+ try
+ {
+ int indexOfTouchAFPositionResult = 1;
+ JSONArray resultsObj = replyJson.getJSONArray("result");
+ if (!resultsObj.isNull(indexOfTouchAFPositionResult))
+ {
+ JSONObject touchAFPositionResultObj = resultsObj.getJSONObject(indexOfTouchAFPositionResult);
+ afResult = touchAFPositionResultObj.getBoolean("AFResult");
+ Log.v(TAG, "AF Result : " + afResult);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (afResult);
+ }
+}
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.operation;
+
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+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.utils.SimpleHttpClient;
+import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
+import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
+
+public class OlympusPenSingleShotControl
+{
+ private static final String TAG = SingleShotControl.class.getSimpleName();
+ private static final int TIMEOUT_MS = 3000;
+ private final IAutoFocusFrameDisplay frameDisplayer;
+ private final IIndicatorControl indicator;
+ private IPanasonicCamera camera = null;
+
+ /**
+ *
+ *
+ */
+ public OlympusPenSingleShotControl(@NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull IIndicatorControl indicator)
+ {
+ this.frameDisplayer = frameDisplayer;
+ this.indicator = indicator;
+ }
+
+ /**
+ *
+ *
+ */
+ public void setCamera(@NonNull IPanasonicCamera panasonicCamera)
+ {
+ this.camera = panasonicCamera;
+ }
+
+ /**
+ *
+ *
+ */
+ public void singleShot()
+ {
+ Log.v(TAG, "singleShot()");
+ if (camera == null)
+ {
+ Log.v(TAG, "IPanasonicCamera is null...");
+ return;
+ }
+ try
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ String reply = SimpleHttpClient.httpGet(camera.getCmdUrl() + "cam.cgi?mode=camcmd&value=capture", TIMEOUT_MS);
+ if (!reply.contains("ok"))
+ {
+ Log.v(TAG, "Capture Failure... : " + reply);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ frameDisplayer.hideFocusFrame();
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.wrapper;
+
+import net.osdn.gokigen.a01d.camera.ICameraInformation;
+import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class OlympusPenCameraInformation implements ICameraInformation, IOlyCameraPropertyProvider
+{
+ OlympusPenCameraInformation()
+ {
+
+ }
+
+ @Override
+ public boolean isManualFocus()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isElectricZoomLens()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isExposureLocked()
+ {
+ return false;
+ }
+
+ @Override
+ public Set<String> getCameraPropertyNames() {
+ return null;
+ }
+
+ @Override
+ public String getCameraPropertyValue(String name) {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getCameraPropertyValues(Set<String> names) {
+ return null;
+ }
+
+ @Override
+ public String getCameraPropertyTitle(String name) {
+ return null;
+ }
+
+ @Override
+ public List<String> getCameraPropertyValueList(String name) {
+ return null;
+ }
+
+ @Override
+ public String getCameraPropertyValueTitle(String propertyValue) {
+ return null;
+ }
+
+ @Override
+ public void setCameraPropertyValue(String name, String value) {
+
+ }
+
+ @Override
+ public void setCameraPropertyValues(Map<String, String> values) {
+
+ }
+
+ @Override
+ public boolean canSetCameraProperty(String name) {
+ return false;
+ }
+}
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.wrapper;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.camera.ICameraStatus;
+import net.osdn.gokigen.a01d.camera.ICameraStatusWatcher;
+import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
+
+import java.util.List;
+
+public class OlympusPenCameraStatusWatcher implements ICameraStatusWatcher, ICameraStatus
+{
+ OlympusPenCameraStatusWatcher()
+ {
+
+ }
+
+
+ @Override
+ public void startStatusWatch(@NonNull ICameraStatusUpdateNotify notifier) {
+
+ }
+
+ @Override
+ public void stopStatusWatch() {
+
+ }
+
+ @Override
+ public List<String> getStatusList(String key) {
+ return null;
+ }
+
+ @Override
+ public String getStatus(String key) {
+ return null;
+ }
+
+ @Override
+ public void setStatus(String key, String value) {
+
+ }
+}
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.wrapper;
+
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.camera.ICaptureControl;
+import net.osdn.gokigen.a01d.camera.olympuspen.operation.OlympusPenSingleShotControl;
+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.liveview.IAutoFocusFrameDisplay;
+import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
+
+public class OlympusPenCaptureControl implements ICaptureControl
+{
+ private static final String TAG = PanasonicCameraCaptureControl.class.getSimpleName();
+ private final OlympusPenSingleShotControl singleShotControl;
+
+ public OlympusPenCaptureControl(@NonNull IAutoFocusFrameDisplay frameDisplayer, @NonNull IIndicatorControl indicator)
+ {
+ singleShotControl = new OlympusPenSingleShotControl(frameDisplayer, indicator);
+ }
+
+ public void setCamera(@NonNull IPanasonicCamera panasonicCamera)
+ {
+ singleShotControl.setCamera(panasonicCamera);
+ }
+
+ /**
+ * 撮影する
+ *
+ */
+ @Override
+ public void doCapture(int kind)
+ {
+ Log.v(TAG, "doCapture() : " + kind);
+ try
+ {
+ singleShotControl.singleShot();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.wrapper;
+
+import android.graphics.PointF;
+import android.util.Log;
+import android.view.MotionEvent;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.camera.IFocusingControl;
+import net.osdn.gokigen.a01d.camera.olympuspen.operation.OlympusPenAutoFocusControl;
+import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
+import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
+
+public class OlympusPenFocusControl implements IFocusingControl
+{
+ private final String TAG = toString();
+ private final OlympusPenAutoFocusControl afControl;
+ private final IAutoFocusFrameDisplay frameDisplay;
+
+ public OlympusPenFocusControl(@NonNull final IAutoFocusFrameDisplay frameDisplayer, @NonNull final IIndicatorControl indicator)
+ {
+ this.frameDisplay = frameDisplayer;
+ afControl = new OlympusPenAutoFocusControl(frameDisplayer, indicator);
+ }
+
+ @Override
+ public boolean driveAutoFocus(final MotionEvent motionEvent)
+ {
+ Log.v(TAG, "driveAutoFocus()");
+ if (motionEvent.getAction() != MotionEvent.ACTION_DOWN)
+ {
+ return (false);
+ }
+ try
+ {
+ PointF point = frameDisplay.getPointWithEvent(motionEvent);
+ if (frameDisplay.isContainsPoint(point))
+ {
+ afControl.lockAutoFocus(point);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public void unlockAutoFocus()
+ {
+ Log.v(TAG, "unlockAutoFocus()");
+ try
+ {
+ afControl.unlockAutoFocus();
+ frameDisplay.hideFocusFrame();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void halfPressShutter(boolean isPressed)
+ {
+ Log.v(TAG, "halfPressShutter() " + isPressed);
+ try
+ {
+ afControl.halfPressShutter(isPressed);
+ if (!isPressed)
+ {
+ // フォーカスを外す
+ frameDisplay.hideFocusFrame();
+ afControl.unlockAutoFocus();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
package net.osdn.gokigen.a01d.camera.olympuspen.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.a01d.camera.ICameraConnection;
import net.osdn.gokigen.a01d.camera.ICameraInformation;
import net.osdn.gokigen.a01d.camera.IZoomLensControl;
import net.osdn.gokigen.a01d.camera.olympus.wrapper.ICameraHardwareStatus;
import net.osdn.gokigen.a01d.camera.olympus.wrapper.ICameraRunMode;
+import net.osdn.gokigen.a01d.camera.olympus.wrapper.property.IOlyCameraPropertyProvider;
import net.osdn.gokigen.a01d.camera.olympuspen.IOlympusPenInterfaceProvider;
import net.osdn.gokigen.a01d.camera.olympuspen.wrapper.connection.OlympusPenConnection;
import net.osdn.gokigen.a01d.camera.olympuspen.wrapper.hardware.OlympusPenHardwareStatus;
import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener;
-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
/**
*
private final OlympusPenConnection olympusPenConnection;
private final OlympusPenHardwareStatus hardwareStatus;
private final OlympusPenRunMode runMode;
+ private final OlympusPenLiveViewControl liveViewControl;
+ private final OlympusPenZoomLensControl zoomLensControl;
+ private final OlympusPenCameraInformation cameraInformation;
+ private final OlympusPenCameraStatusWatcher statusWatcher;
+ private OlympusPenFocusControl focusControl = null;
+ private OlympusPenCaptureControl captureControl = null;
/**
*
olympusPenConnection = new OlympusPenConnection(context, provider);
hardwareStatus = new OlympusPenHardwareStatus();
runMode = new OlympusPenRunMode();
+ liveViewControl = new OlympusPenLiveViewControl();
+ zoomLensControl = new OlympusPenZoomLensControl();
+ cameraInformation = new OlympusPenCameraInformation();
+ statusWatcher = new OlympusPenCameraStatusWatcher();
}
public void prepare()
public void injectDisplay(IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator, IFocusingModeNotify focusingModeNotify)
{
Log.v(TAG, "injectDisplay()");
+ focusControl = new OlympusPenFocusControl(frameDisplayer, indicator);
+ captureControl = new OlympusPenCaptureControl(frameDisplayer, indicator);
}
@Override
@Override
public ILiveViewControl getLiveViewControl()
{
- return (null);
+ return (liveViewControl);
}
@Override
public ILiveViewListener getLiveViewListener()
{
- return (null);
+ return (liveViewControl.getLiveViewListener());
}
@Override
public IFocusingControl getFocusingControl()
{
- return (null);
+ return (focusControl);
}
@Override
public ICameraInformation getCameraInformation()
{
- return (null);
+ return (cameraInformation);
}
@Override
public IZoomLensControl getZoomLensControl()
{
- return (null);
+ return (zoomLensControl);
}
@Override
public ICaptureControl getCaptureControl()
{
- return (null);
+ return (captureControl);
}
@Override
}
@Override
+ public IOlyCameraPropertyProvider getCameraPropertyProvider()
+ {
+ return (cameraInformation);
+ }
+
+ @Override
public ICameraStatus getCameraStatusListHolder()
{
- return (null);
+ return (statusWatcher);
}
@Override
public ICameraStatusWatcher getCameraStatusWatcher() {
- return (null);
+ return (statusWatcher);
}
@Override
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.wrapper;
+
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.camera.ILiveViewControl;
+import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
+import net.osdn.gokigen.a01d.liveview.liveviewlistener.CameraLiveViewListenerImpl;
+import net.osdn.gokigen.a01d.liveview.liveviewlistener.ILiveViewListener;
+
+import java.io.ByteArrayOutputStream;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+public class OlympusPenLiveViewControl implements ILiveViewControl
+{
+ private final String TAG = toString();
+ private final CameraLiveViewListenerImpl liveViewListener;
+ private DatagramSocket receiveSocket = null;
+ private boolean whileStreamReceive = false;
+
+ private static final int TIMEOUT_MAX = 3;
+ private static final int RECEIVE_BUFFER_SIZE = 1024 * 1024 * 4;
+ private static final int TIMEOUT_MS = 1500;
+ private static final int LIVEVIEW_PORT = 49152;
+
+ private final String COMMUNICATION_URL = "http://192.168.0.10/";
+ private final String LIVEVIEW_START_REQUEST = "exec_takemisc.cgi?com=startliveview&port=49152";
+ private final String LIVEVIEW_STOP_REQUEST = "exec_takemisc.cgi?com=stopliveview";
+
+ private Map<String, String> headerMap;
+ private ByteArrayOutputStream receivedByteStream;
+
+ OlympusPenLiveViewControl()
+ {
+ liveViewListener = new CameraLiveViewListenerImpl();
+
+ headerMap = new HashMap<>();
+ headerMap.put("User-Agent", "OlympusCameraKit"); // "OI.Share"
+ headerMap.put("X-Protocol", "OlympusCameraKit"); // "OI.Share"
+
+ receivedByteStream = new ByteArrayOutputStream(RECEIVE_BUFFER_SIZE);
+ }
+
+ @Override
+ public void changeLiveViewSize(String size)
+ {
+
+ }
+
+ @Override
+ public void startLiveView()
+ {
+ Log.v(TAG, "startLiveView()");
+ try
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ startReceiveStream();
+ if (!whileStreamReceive)
+ {
+ Log.v(TAG, "CANNOT OPEN : UDP RECEIVE SOCKET");
+ return;
+ }
+ String requestUrl = COMMUNICATION_URL + LIVEVIEW_START_REQUEST;
+ String reply = SimpleHttpClient.httpGetWithHeader(requestUrl, headerMap, null, TIMEOUT_MS);
+ Log.v(TAG, " ----- START LIVEVIEW ----- : " + requestUrl + " " + reply);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void stopLiveView()
+ {
+ Log.v(TAG, "stopLiveView()");
+ try
+ {
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ String requestUrl = COMMUNICATION_URL + LIVEVIEW_STOP_REQUEST;
+ String reply = SimpleHttpClient.httpGetWithHeader(requestUrl, headerMap, null, TIMEOUT_MS);
+ Log.v(TAG, "stopLiveview() is issued. " + reply);
+
+ // ライブビューウォッチャーを止める
+ whileStreamReceive = false;
+ closeReceiveSocket();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void updateDigitalZoom()
+ {
+
+ }
+
+ @Override
+ public void updateMagnifyingLiveViewScale(boolean isChangeScale)
+ {
+
+ }
+
+ @Override
+ public float getMagnifyingLiveViewScale()
+ {
+ return (1.0f);
+ }
+
+ @Override
+ public float getDigitalZoomScale()
+ {
+ return (1.0f);
+ }
+
+ private void startReceiveStream()
+ {
+ if (whileStreamReceive)
+ {
+ Log.v(TAG, "startReceiveStream() : already starting.");
+ return;
+ }
+
+ // ソケットをあける (UDP)
+ try
+ {
+ receiveSocket = new DatagramSocket(LIVEVIEW_PORT);
+ whileStreamReceive = true;
+ receivedByteStream.flush();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ whileStreamReceive = false;
+ receiveSocket = null;
+ }
+
+ // 受信スレッドを動かす
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ receiverThread();
+ }
+ });
+ try
+ {
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void checkReceiveImage(@NonNull DatagramPacket packet)
+ {
+ try
+ {
+ int dataLength = packet.getLength();
+ byte[] receivedData = packet.getData();
+ if (receivedData == null)
+ {
+ // 受信データが取れなかったのでいったん終了する
+ Log.v(TAG, "RECEIVED DATA IS NULL...");
+ return;
+ }
+
+ int position = 12;
+ int extensionLength = 0;
+ boolean isFinished = false;
+ if (receivedData[0] == (byte) 0x90)
+ {
+ // 先頭パケット (RTPヘッダは 12bytes + 拡張ヘッダ...)
+ //extensionLength = (receivedData[14]);
+ //extensionLength = (extensionLength * 256) + (receivedData[15]);
+ extensionLength = 16;
+ extensionLength = checkJpegStartPosition(receivedData, extensionLength) - position;
+
+ }
+ else if (receivedData[1] == (byte) 0xe0)
+ {
+ // 末尾パケット (RTPヘッダは 12bytes)
+ isFinished = true;
+ }
+ //Log.v(TAG, "RECEIVED PACKET : " + dataLength + " [" + isFinished + "] ext : " + extensionLength);
+
+ int offset = position + extensionLength;
+ receivedByteStream.write(receivedData, (position + extensionLength), (dataLength - offset));
+ if (isFinished)
+ {
+ byte[] dataArray = receivedByteStream.toByteArray();
+/*
+ {
+ byte[] start = Arrays.copyOfRange(dataArray, 0, 32);
+ byte[] end = Arrays.copyOfRange(dataArray, (dataArray.length - 32), dataArray.length);
+ dump_bytes(" ST ", start);
+ dump_bytes(" ED ", end);
+ }
+*/
+ liveViewListener.onUpdateLiveView(Arrays.copyOf(dataArray, dataArray.length), null);
+ receivedByteStream.flush();
+ //System.gc();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private int checkJpegStartPosition(byte[] bytes, int offset)
+ {
+ try
+ {
+ int position = offset;
+ int maxLength = bytes.length - 1;
+ while (position < maxLength)
+ {
+ if (bytes[position] == (byte) 0xff)
+ {
+ if (bytes[position + 1] == (byte) 0xd8)
+ {
+ return (position);
+ }
+ }
+ position++;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (0);
+ }
+
+ private void receiverThread()
+ {
+ int exceptionCount = 0;
+ byte[] buffer = new byte[RECEIVE_BUFFER_SIZE];
+ while (whileStreamReceive)
+ {
+ try
+ {
+ DatagramPacket receive_packet = new DatagramPacket(buffer, buffer.length);
+ if (receiveSocket != null)
+ {
+ receiveSocket.setSoTimeout(TIMEOUT_MS);
+ receiveSocket.receive(receive_packet);
+ checkReceiveImage(receive_packet);
+ exceptionCount = 0;
+ }
+ else
+ {
+ Log.v(TAG, "receiveSocket is NULL...");
+ }
+ }
+ catch (Exception e)
+ {
+ exceptionCount++;
+ e.printStackTrace();
+ if (exceptionCount > TIMEOUT_MAX)
+ {
+ try
+ {
+ // ライブビューの送信が来なくなった... それも回数が超えた...
+ Log.v(TAG, "LV : RETRY REQUEST");
+ exceptionCount = 0;
+/*
+ String reply = SimpleHttpClient.httpGet(camera.getCmdUrl() + LIVEVIEW_START_REQUEST, TIMEOUT_MS);
+ if (!reply.contains("ok"))
+ {
+ Log.v(TAG, "LV : RETRY COMMAND FAIL...");
+ }
+*/
+ }
+ catch (Exception ee)
+ {
+ ee.printStackTrace();
+ }
+ }
+ }
+ }
+ closeReceiveSocket();
+ Log.v(TAG, " ----- startReceiveStream() : Finished.");
+ System.gc();
+ }
+
+ public ILiveViewListener getLiveViewListener()
+ {
+ return (liveViewListener);
+ }
+
+ private void closeReceiveSocket()
+ {
+ Log.v(TAG, "closeReceiveSocket()");
+ try
+ {
+ if (receiveSocket != null)
+ {
+ Log.v(TAG, " ----- SOCKET CLOSE ----- ");
+ receiveSocket.close();
+ receiveSocket = null;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
public class OlympusPenRunMode implements ICameraRunMode
{
private final String TAG = this.toString();
+ private boolean runMode = false;
@Override
public void changeRunMode(final boolean isRecording)
final int TIMEOUT_MS = 5000;
try
{
+ Log.v(TAG, " changeRunMode : " + isRecording);
final Thread thread = new Thread(new Runnable()
{
@Override
headerMap.put("User-Agent", "OlympusCameraKit"); // "OI.Share"
headerMap.put("X-Protocol", "OlympusCameraKit"); // "OI.Share"
- String playModeUrl = "http://192.168.0.10/switch_cameramode.cgi";
+ String playModeUrl = "http://192.168.0.10/switch_cammode.cgi";
if (isRecording)
{
playModeUrl = playModeUrl + "?mode=rec";
}
String response = SimpleHttpClient.httpGetWithHeader(playModeUrl, headerMap, null, TIMEOUT_MS);
Log.v(TAG, " " + playModeUrl + " " + response);
+ try
+ {
+ if (response.contains("ok"))
+ {
+ runMode = isRecording;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
});
thread.start();
@Override
public boolean isRecordingMode()
{
- return (true);
+ return (runMode);
}
}
--- /dev/null
+package net.osdn.gokigen.a01d.camera.olympuspen.wrapper;
+
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.camera.IZoomLensControl;
+import net.osdn.gokigen.a01d.camera.panasonic.wrapper.IPanasonicCamera;
+import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
+
+public class OlympusPenZoomLensControl implements IZoomLensControl
+{
+ private final String TAG = toString();
+ private IPanasonicCamera camera = null;
+ private boolean isZooming = false;
+ private static final int TIMEOUT_MS = 3000;
+
+ OlympusPenZoomLensControl()
+ {
+ Log.v(TAG, "OlympusPenZoomLensControl()");
+ }
+
+ public void setCamera(@NonNull IPanasonicCamera panasonicCamera)
+ {
+ camera = panasonicCamera;
+ }
+
+ @Override
+ public boolean canZoom() {
+ Log.v(TAG, "canZoom()");
+ return (true);
+ }
+
+ @Override
+ public void updateStatus()
+ {
+ Log.v(TAG, "updateStatus()");
+ }
+
+ @Override
+ public float getMaximumFocalLength()
+ {
+ Log.v(TAG, "getMaximumFocalLength()");
+ return (0);
+ }
+
+ @Override
+ public float getMinimumFocalLength()
+ {
+ Log.v(TAG, "getMinimumFocalLength()");
+ return (0);
+ }
+
+ @Override
+ public float getCurrentFocalLength()
+ {
+ Log.v(TAG, "getCurrentFocalLength()");
+ return (0);
+ }
+
+ @Override
+ public void driveZoomLens(float targetLength)
+ {
+ Log.v(TAG, "driveZoomLens() : " + targetLength);
+ }
+
+ @Override
+ public void moveInitialZoomPosition()
+ {
+ Log.v(TAG, "moveInitialZoomPosition()");
+ }
+
+ @Override
+ public boolean isDrivingZoomLens()
+ {
+ Log.v(TAG, "isDrivingZoomLens()");
+ return (isZooming);
+ }
+
+ /**
+ *
+ *
+ */
+ @Override
+ public void driveZoomLens(boolean isZoomIn)
+ {
+ Log.v(TAG, "driveZoomLens() : " + isZoomIn);
+ if (camera == null)
+ {
+ Log.v(TAG, "IPanasonicCameraApi is null...");
+ return;
+ }
+ try
+ {
+ String command;
+ if (isZooming)
+ {
+ command = "cam.cgi?mode=camcmd&value=zoomstop";
+ }
+ else
+ {
+ command = (isZoomIn) ? "cam.cgi?mode=camcmd&value=tele-normal" : "cam.cgi?mode=camcmd&value=wide-normal";
+ }
+ final String direction = command;
+ Thread thread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ String reply = SimpleHttpClient.httpGet(camera.getCmdUrl() + direction, TIMEOUT_MS);
+ if (reply.contains("ok"))
+ {
+ isZooming = !isZooming;
+ }
+ else
+ {
+ Log.v(TAG, "driveZoomLens() reply is failure.");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
final String camInfoUrl = "http://192.168.0.10/get_caminfo.cgi";
final String getCommandListUrl = "http://192.168.0.10/get_commandlist.cgi";
final String getConnectModeUrl = "http://192.168.0.10/get_connectmode.cgi";
+ final String switchCameraModeUrl = "http://192.168.0.10/switch_cammode.cgi";
final int TIMEOUT_MS = 5000;
try
String response3 = SimpleHttpClient.httpGetWithHeader(camInfoUrl, headerMap, null, TIMEOUT_MS);
Log.v(TAG, " " + camInfoUrl + " " + response3);
+ // 撮影モードに切り替え。
+ String lvUrl = switchCameraModeUrl + "?mode=rec" + "&lvqty=" + getLiveViewQuality();
+ String response4 = SimpleHttpClient.httpGetWithHeader(lvUrl, headerMap, null, TIMEOUT_MS);
+ Log.v(TAG, " " + lvUrl + " " + response4);
+
onConnectNotify();
}
else
}
}
+ private String getLiveViewQuality()
+ {
+ // ※ LV解像度をここで取得する
+ return ("0640x0480");
+ }
+
private void onConnectNotify()
{
try
{
Log.v(TAG, "alertConnectingFailed() : " + message);
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setTitle(context.getString(R.string.dialog_title_connect_failed))
+ .setTitle(context.getString(R.string.dialog_title_connect_failed_olympus))
.setMessage(message)
.setPositiveButton(context.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
@Override
{
Log.v(TAG, "alertConnectingFailed() : " + message);
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setTitle(context.getString(R.string.dialog_title_connect_failed))
+ .setTitle(context.getString(R.string.dialog_title_connect_failed_panasonic))
.setMessage(message)
.setPositiveButton(context.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
@Override
{
Log.v(TAG, "alertConnectingFailed() : " + message);
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setTitle(context.getString(R.string.dialog_title_connect_failed))
+ .setTitle(context.getString(R.string.dialog_title_connect_failed_ricoh))
.setMessage(message)
.setPositiveButton(context.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
@Override
{
Log.v(TAG, "alertConnectingFailed() : " + message);
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setTitle(context.getString(R.string.dialog_title_connect_failed))
+ .setTitle(context.getString(R.string.dialog_title_connect_failed_sony))
.setMessage(message)
.setPositiveButton(context.getString(R.string.dialog_title_button_retry), new DialogInterface.OnClickListener() {
@Override
--- /dev/null
+package net.osdn.gokigen.a01d.camera.utils;
+
+import android.app.Activity;
+import android.os.Environment;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.R;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Locale;
+
+public class SimpleLogDumper
+{
+ private static final String TAG = SimpleLogDumper.class.getSimpleName();
+
+ /**
+ * デバッグ用:ログにバイト列を出力する
+ *
+ */
+ public static void dump_bytes(String header, byte[] data)
+ {
+ if (data == null)
+ {
+ Log.v(TAG, "DATA IS NULL");
+ return;
+ }
+ if (data.length > 8192)
+ {
+ Log.v(TAG, " --- DUMP DATA IS TOO LONG... " + data.length + " bytes.");
+ return;
+ }
+
+ int index = 0;
+ StringBuffer message;
+ message = new StringBuffer();
+ for (byte item : data)
+ {
+ index++;
+ message.append(String.format("%02x ", item));
+ if (index >= 16)
+ {
+ Log.v(TAG, header + " " + message);
+ index = 0;
+ message = new StringBuffer();
+ }
+ }
+ if (index != 0)
+ {
+ Log.v(TAG, header + " " + message);
+ }
+ System.gc();
+ }
+
+ public static void binaryOutputToFile(@NonNull Activity activity, String fileNamePrefix, byte[] rx_body)
+ {
+ try
+ {
+ Calendar calendar = Calendar.getInstance();
+ String extendName = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.getDefault()).format(calendar.getTime());
+ final String directoryPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getPath() + "/" + activity.getString(R.string.app_name2) + "/";
+ String outputFileName = fileNamePrefix + "_" + extendName + ".bin";
+ String filepath = new File(directoryPath.toLowerCase(), outputFileName.toLowerCase()).getPath();
+ FileOutputStream outputStream = new FileOutputStream(filepath);
+ outputStream.write(rx_body, 0, rx_body.length);
+ outputStream.flush();
+ outputStream.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
this.cameraConnection = interfaceProvider.getPanasonicInterface().getPanasonicCameraConnection();
this.zoomLensControl = interfaceProvider.getPanasonicInterface().getZoomLensControl();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+ {
+ this.focusingControl = interfaceProvider.getOlympusPenInterface().getFocusingControl();
+ this.captureControl = interfaceProvider.getOlympusPenInterface().getCaptureControl();
+ this.propertyProvider = interfaceProvider.getOlympusPenInterface().getCameraPropertyProvider();
+ this.cameraInformation = interfaceProvider.getOlympusPenInterface().getCameraInformation();
+ this.cameraConnection = interfaceProvider.getOlympusPenInterface().getOlyCameraConnection();
+ this.zoomLensControl = interfaceProvider.getOlympusPenInterface().getZoomLensControl();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
this.focusingControl = interfaceProvider.getOlympusInterface().getFocusingControl();
propertyButton.setOnClickListener(onClickTouchListener);
}
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+ {
+ /*
+ 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.VISIBLE);
+ }
+ if (propertyButton != null)
+ {
+ propertyButton.setOnClickListener(onClickTouchListener);
+ }
+ */
+ }
}
if (manualFocus != null)
{
{
interfaceInjector = interfaceProvider.getPanasonicInterface().getDisplayInjector();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+ {
+ interfaceInjector = interfaceProvider.getOlympusPenInterface().getDisplayInjector();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
interfaceInjector = interfaceProvider.getOlympusInterface().getDisplayInjector();
this.zoomLensControl = interfaceProvider.getPanasonicInterface().getZoomLensControl();
this.cameraInformation = interfaceProvider.getPanasonicInterface().getCameraInformation();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+ {
+ this.liveViewControl = interfaceProvider.getOlympusPenInterface().getLiveViewControl();
+ this.zoomLensControl = interfaceProvider.getOlympusPenInterface().getZoomLensControl();
+ this.cameraInformation = interfaceProvider.getOlympusPenInterface().getCameraInformation();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
this.liveViewControl = interfaceProvider.getOlympusInterface().getLiveViewControl();
{
lvListener = interfaceProvider.getPanasonicInterface().getLiveViewListener();
}
+ else if (connectionMethod == ICameraConnection.CameraConnectionMethod.OLYMPUS)
+ {
+ lvListener = interfaceProvider.getOlympusPenInterface().getLiveViewListener();
+ }
else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
{
interfaceProvider.getOlympusLiveViewListener().setOlympusLiveViewListener(liveViewListener);
String AUTO_CONNECT_TO_CAMERA = "auto_connect_to_camera";
String BLE_POWER_ON = "ble_power_on";
+ String WIFI_SETTINGS = "wifi_settings";
+
String TAKE_MODE = "take_mode";
String TAKE_MODE_DEFAULT_VALUE = "P";
package net.osdn.gokigen.a01d.preference.fujix;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.provider.Settings;
import android.util.Log;
import net.osdn.gokigen.a01d.IChangeScene;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.WIFI_SETTINGS;
+
/**
*
*
*/
-public class FujiXPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener
+public class FujiXPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceClickListener
{
private final String TAG = toString();
+ private AppCompatActivity context = null;
private SharedPreferences preferences = null;
private CameraPowerOffFujiX powerOffController = null;
private LogCatViewer logCatViewer = null;
logCatViewer = new LogCatViewer(changeScene);
logCatViewer.prepare();
+
+ this.context = context;
}
catch (Exception e)
{
findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
- }
+ findPreference(WIFI_SETTINGS).setOnPreferenceClickListener(this);
+ }
catch (Exception e)
{
e.printStackTrace();
}
}
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ try
+ {
+ String preferenceKey = preference.getKey();
+ if (preferenceKey.contains(WIFI_SETTINGS))
+ {
+ // Wifi 設定画面を表示する
+ Log.v(TAG, " onPreferenceClick : " + preferenceKey);
+ if (context != null)
+ {
+ context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ }
+ }
+ return (true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
}
import android.app.ProgressDialog;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.provider.Settings;
import android.util.Log;
import net.osdn.gokigen.a01d.IChangeScene;
import androidx.preference.PreferenceManager;
import jp.co.olympus.camerakit.OLYCamera;
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.WIFI_SETTINGS;
+
/**
* SettingFragment
*
*/
-public class PreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, PreferenceSynchronizer.IPropertySynchronizeCallback
+public class PreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, PreferenceSynchronizer.IPropertySynchronizeCallback, Preference.OnPreferenceClickListener
{
private final String TAG = toString();
+ private AppCompatActivity context = null;
private IOlyCameraPropertyProvider propertyInterface = null;
private ICameraHardwareStatus hardwareStatusInterface = null;
private ICameraRunMode changeRunModeExecutor = null;
powerOnSelector.prepare();
logCatViewer = new LogCatViewer(changeScene);
logCatViewer.prepare();
+
+ this.context = context;
}
/**
//super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
+ try
{
final HashMap<String, String> sizeTable = new HashMap<>();
sizeTable.put("QVGA", "(320x240)");
}
});
connectionMethod.setSummary(connectionMethod.getValue() + " ");
+
+ findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
+ findPreference("olympus_air_bt").setOnPreferenceClickListener(powerOnSelector);
+ findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
+ findPreference(WIFI_SETTINGS).setOnPreferenceClickListener(this);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
}
- findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
- findPreference("olympus_air_bt").setOnPreferenceClickListener(powerOnSelector);
- findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
}
/**
});
}
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ try
+ {
+ String preferenceKey = preference.getKey();
+ if (preferenceKey.contains(WIFI_SETTINGS))
+ {
+ // Wifi 設定画面を表示する
+ Log.v(TAG, " onPreferenceClick : " + preferenceKey);
+ if (context != null)
+ {
+ context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ }
+ }
+ return (true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
}
package net.osdn.gokigen.a01d.preference.olympuspen;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.provider.Settings;
import android.util.Log;
import androidx.annotation.NonNull;
import java.util.Map;
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.WIFI_SETTINGS;
+
/**
*
*
*/
-public class OlympusPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener
+public class OlympusPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceClickListener
{
private final String TAG = toString();
+ private AppCompatActivity context = null;
private SharedPreferences preferences = null;
private OlympusPenCameraPowerOff powerOffController = null;
private LogCatViewer logCatViewer = null;
//cameraApiListViewer = new PanasonicCameraApiListViewer(changeScene);
//cameraApiListViewer.prepare();
+
+ this.context = context;
}
catch (Exception e)
{
findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
//findPreference("panasonic_api_list").setOnPreferenceClickListener(cameraApiListViewer);
+ findPreference(WIFI_SETTINGS).setOnPreferenceClickListener(this);
}
catch (Exception e)
{
}
}
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ try
+ {
+ String preferenceKey = preference.getKey();
+ if (preferenceKey.contains(WIFI_SETTINGS))
+ {
+ // Wifi 設定画面を表示する
+ Log.v(TAG, " onPreferenceClick : " + preferenceKey);
+ if (context != null)
+ {
+ context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ }
+ }
+ return (true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
}
package net.osdn.gokigen.a01d.preference.panasonic;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.provider.Settings;
import android.util.Log;
import net.osdn.gokigen.a01d.IChangeScene;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.WIFI_SETTINGS;
+
/**
*
*
*/
-public class PanasonicPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener
+public class PanasonicPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceClickListener
{
private final String TAG = toString();
+ private AppCompatActivity context = null;
private SharedPreferences preferences = null;
private CameraPowerOffPanasonic powerOffController = null;
private LogCatViewer logCatViewer = null;
//cameraApiListViewer = new PanasonicCameraApiListViewer(changeScene);
//cameraApiListViewer.prepare();
+
+ this.context = context;
}
catch (Exception e)
{
findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
//findPreference("panasonic_api_list").setOnPreferenceClickListener(cameraApiListViewer);
+ findPreference(WIFI_SETTINGS).setOnPreferenceClickListener(this);
}
catch (Exception e)
{
}
}
+
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ try
+ {
+ String preferenceKey = preference.getKey();
+ if (preferenceKey.contains(WIFI_SETTINGS))
+ {
+ // Wifi 設定画面を表示する
+ Log.v(TAG, " onPreferenceClick : " + preferenceKey);
+ if (context != null)
+ {
+ context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ }
+ }
+ return (true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
}
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.provider.Settings;
import android.util.Log;
import net.osdn.gokigen.a01d.IChangeScene;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
-public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.WIFI_SETTINGS;
+
+public class RicohGr2PreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceClickListener
{
private final String TAG = toString();
+ private AppCompatActivity context = null;
private SharedPreferences preferences = null;
private CameraPowerOffRicohGr2 powerOffController = null;
private LogCatViewer logCatViewer = null;
logCatViewer = new LogCatViewer(changeScene);
logCatViewer.prepare();
+
+ this.context = context;
}
catch (Exception e)
{
findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
+ findPreference(WIFI_SETTINGS).setOnPreferenceClickListener(this);
}
catch (Exception e)
{
});
}
}
+
+
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ try
+ {
+ String preferenceKey = preference.getKey();
+ if (preferenceKey.contains(WIFI_SETTINGS))
+ {
+ // Wifi 設定画面を表示する
+ Log.v(TAG, " onPreferenceClick : " + preferenceKey);
+ if (context != null)
+ {
+ context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ }
+ }
+ return (true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
}
package net.osdn.gokigen.a01d.preference.sony;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
+import android.provider.Settings;
import android.util.Log;
import net.osdn.gokigen.a01d.IChangeScene;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.WIFI_SETTINGS;
+
/**
*
*
*/
-public class SonyPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener
+public class SonyPreferenceFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceClickListener
{
private final String TAG = toString();
+ private AppCompatActivity context = null;
private SharedPreferences preferences = null;
private CameraPowerOffSony powerOffController = null;
private LogCatViewer logCatViewer = null;
cameraApiListViewer = new SonyCameraApiListViewer(changeScene);
cameraApiListViewer.prepare();
+
+ this.context = context;
}
catch (Exception e)
{
findPreference("exit_application").setOnPreferenceClickListener(powerOffController);
findPreference("debug_info").setOnPreferenceClickListener(logCatViewer);
findPreference("sony_api_list").setOnPreferenceClickListener(cameraApiListViewer);
+ findPreference(WIFI_SETTINGS).setOnPreferenceClickListener(this);
}
catch (Exception e)
{
}
}
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ try
+ {
+ String preferenceKey = preference.getKey();
+ if (preferenceKey.contains(WIFI_SETTINGS))
+ {
+ // Wifi 設定画面を表示する
+ Log.v(TAG, " onPreferenceClick : " + preferenceKey);
+ if (context != null)
+ {
+ context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ }
+ }
+ return (true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
}
<string-array name="connection_method">
<item >OPC (Olympus Air)</item>
+ <item >Olympus Pen/OM-D</item>
<item >Sony</item>
- <item>Ricoh GR Series / PENTAX</item>
+ <item >Ricoh GR Series / PENTAX</item>
<item >Fuji X Series</item>
<item >Panasonic</item>
- <item >Olympus Pen/OM-D</item>
</string-array>
<string-array name="connection_method_value">
<item >OPC</item>
+ <item >OLYMPUS</item>
<item >SONY</item>
<item >RICOH_GR2</item>
<item >FUJI_X</item>
<item >PANASONIC</item>
- <item >OLYMPUS</item>
</string-array>
<string name="pref_instruction_manual">操作説明</string>
<string name="pref_privacy_policy">プライバシーポリシー</string>
+ <string name="pref_wifi_settings">WiFi設定</string>
+ <string name="pref_summary_wifi_settings"> </string>
+
<string name="information"> </string>
<string name="favorite">お気に入り</string>
<string name="preferences">設定</string>
<string name="dialog_start_load_property_title">カメラプロパティ設定中</string>
<string name="dialog_title_button_network_settings">WiFi設定</string>
<string name="dialog_title_button_retry">再試行</string>
- <string name="dialog_title_connect_failed">接続失敗</string>
+ <string name="dialog_title_connect_failed_ricoh">接続失敗(RICOH)</string>
+ <string name="dialog_title_connect_failed_opc">接続失敗(OPC)</string>
+ <string name="dialog_title_connect_failed_olympus">接続失敗(Olympus)</string>
+ <string name="dialog_title_connect_failed_panasonic">接続失敗(PANASONIC)</string>
+ <string name="dialog_title_connect_failed_sony">接続失敗(SONY)</string>
+ <string name="dialog_title_connect_failed_fuji">接続失敗(FUJI)</string>
<string name="fatal_cannot_use_camera">Olympus Camera Kitが動作しないモードのため、カメラのリセットが必要です。電源ボタンを8秒以上長押しして、カメラをリセットしてください。</string>
<string name="network_connection_timeout">接続タイムアウト</string>
<string name="restored_my_props">設定を展開しました。 : </string>
<string name="connect_connecting11">接続中…(11/12)</string>
<string name="connect_connecting12">接続中…(12/12)</string>
<string name="connect_connect_finished">カメラと接続</string>
- <string name="connect_error_message">接続失敗</string>
+
+ <string name="connect_error_message_olympus">接続失敗 (OLYMPUS)</string>
+ <string name="connect_error_message_fuji">接続失敗 (FUJI)</string>
</resources>
<string-array name="connection_method">
<item >OPC (Olympus Air)</item>
+ <item >Olympus Pen/OM-D</item>
<item >Sony</item>
- <item>Ricoh GR Series / PENTAX</item>
+ <item >Ricoh GR Series / PENTAX</item>
<item >Fuji X Series</item>
<item >Panasonic</item>
- <item >Olympus Pen/OM-D</item>
</string-array>
<string-array name="connection_method_value">
<item >OPC</item>
+ <item >OLYMPUS</item>
<item >SONY</item>
<item >RICOH_GR2</item>
<item >FUJI_X</item>
<item >PANASONIC</item>
- <item >OLYMPUS</item>
</string-array>
<string-array name="gr2_display_mode">
<string name="pref_instruction_manual">A01d Instructions</string>
<string name="pref_privacy_policy">Privacy Policy</string>
+ <string name="pref_wifi_settings">WIFI Settings</string>
+ <string name="pref_summary_wifi_settings"> </string>
+
<string name="information"> </string>
<string name="favorite">Favorite</string>
<string name="preferences">Preferences</string>
<string name="grid">Grid</string>
<string name="network_connection_timeout">Connection time out</string>
- <string name="dialog_title_connect_failed">Connect failed</string>
+ <string name="dialog_title_connect_failed_ricoh">Connect failed (RICOH)</string>
+ <string name="dialog_title_connect_failed_opc">Connect failed (OPC)</string>
+ <string name="dialog_title_connect_failed_olympus">Connect failed (Olympus)</string>
+ <string name="dialog_title_connect_failed_panasonic">Connect failed (PANASONIC)</string>
+ <string name="dialog_title_connect_failed_sony">Connect failed (SONY)</string>
+ <string name="dialog_title_connect_failed_fuji">Connect failed (FUJI)</string>
<string name="dialog_title_button_retry">Retry</string>
<string name="dialog_title_button_network_settings">WiFi Settings</string>
<string name="connect_connecting11">Connecting…(11/12)</string>
<string name="connect_connecting12">Connecting…(12/12)</string>
<string name="connect_connect_finished">Connect Finished.</string>
- <string name="connect_error_message">CONNECTION ERROR</string>
+
+ <string name="connect_error_message_olympus">CONNECTION ERROR (OLYMPUS)</string>
+ <string name="connect_error_message_fuji">CONNECTION ERROR (FUJI)</string>
+
</resources>
android:key="connection_method"
android:defaultValue="OPC"/>
+ <PreferenceScreen
+ android:key="wifi_settings"
+ android:title="@string/pref_wifi_settings"
+ android:summary="@string/pref_summary_wifi_settings" />
+
</PreferenceCategory>
<PreferenceCategory
android:key="connection_method"
android:defaultValue="OPC"/>
+ <PreferenceScreen
+ android:key="wifi_settings"
+ android:title="@string/pref_wifi_settings"
+ android:summary="@string/pref_summary_wifi_settings" />
+
</PreferenceCategory>
<PreferenceCategory
android:key="connection_method"
android:defaultValue="OPC"/>
+ <PreferenceScreen
+ android:key="wifi_settings"
+ android:title="@string/pref_wifi_settings"
+ android:summary="@string/pref_summary_wifi_settings" />
+
</PreferenceCategory>
<PreferenceCategory
android:key="connection_method"
android:defaultValue="OPC"/>
+ <PreferenceScreen
+ android:key="wifi_settings"
+ android:title="@string/pref_wifi_settings"
+ android:summary="@string/pref_summary_wifi_settings" />
+
</PreferenceCategory>
<PreferenceCategory
android:key="connection_method"
android:defaultValue="OPC"/>
+ <PreferenceScreen
+ android:key="wifi_settings"
+ android:title="@string/pref_wifi_settings"
+ android:summary="@string/pref_summary_wifi_settings" />
+
</PreferenceCategory>
<PreferenceCategory
android:key="connection_method"
android:defaultValue="OPC"/>
+ <PreferenceScreen
+ android:key="wifi_settings"
+ android:title="@string/pref_wifi_settings"
+ android:summary="@string/pref_summary_wifi_settings" />
+
</PreferenceCategory>
<PreferenceCategory