OSDN Git Service

SONYのシャッター半押し機能を追加する途中。
authorMRSa <mrsa@myad.jp>
Mon, 8 Oct 2018 13:00:19 +0000 (22:00 +0900)
committerMRSa <mrsa@myad.jp>
Mon, 8 Oct 2018 13:00:19 +0000 (22:00 +0900)
23 files changed:
app/src/main/java/net/osdn/gokigen/a01d/camera/CameraInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/a01d/camera/CameraStatusListener.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/camera/ICameraStatus.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/camera/ICameraStatusWatcher.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/camera/IInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/status/RicohGr2StatusChecker.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/status/RicohGr2StatusHolder.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/operation/takepicture/SonyAutoFocusControl.java
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/SonyCameraWrapper.java
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/connection/SonyCameraConnectSequence.java
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/connection/SonyCameraConnection.java
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/eventlistener/CameraChangeListerTemplate.java
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/eventlistener/CameraEventObserver.java
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/eventlistener/ICameraChangeListener.java
app/src/main/java/net/osdn/gokigen/a01d/camera/sony/wrapper/eventlistener/ReplyJsonParser.java
app/src/main/java/net/osdn/gokigen/a01d/camera/utils/SimpleHttpClient.java
app/src/main/java/net/osdn/gokigen/a01d/liveview/CameraLiveImageView.java
app/src/main/java/net/osdn/gokigen/a01d/liveview/ICameraStatusDisplay.java [deleted file]
app/src/main/java/net/osdn/gokigen/a01d/liveview/ICameraStatusUpdateNotify.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/liveview/IFocusLockIndicator.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/liveview/IStatusViewDrawer.java
app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewClickTouchListener.java
app/src/main/java/net/osdn/gokigen/a01d/liveview/LiveViewFragment.java

index 2fb9dda..ff93168 100644 (file)
@@ -12,6 +12,7 @@ import net.osdn.gokigen.a01d.camera.ricohgr2.IRicohGr2InterfaceProvider;
 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.liveview.ICameraStatusUpdateNotify;
 import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
 
 public class CameraInterfaceProvider implements IInterfaceProvider
@@ -20,16 +21,31 @@ public class CameraInterfaceProvider implements IInterfaceProvider
     private final OlympusInterfaceProvider olympus;
     private final SonyCameraWrapper sony;
     private final RicohGr2InterfaceProvider ricohGr2;
+    private final CameraStatusListener statusListener;
 
     public CameraInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
     {
         this.context = context;
+        this.statusListener = new CameraStatusListener();
         olympus = new OlympusInterfaceProvider(context, provider);
-        sony = new SonyCameraWrapper(context, provider);
+        sony = new SonyCameraWrapper(context, provider, statusListener);
         ricohGr2 = new RicohGr2InterfaceProvider(context, provider);
     }
 
     @Override
+    public void setUpdateReceiver(@NonNull ICameraStatusUpdateNotify receiver)
+    {
+        try
+        {
+            statusListener.setUpdateReceiver(receiver);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
     public IOlympusInterfaceProvider getOlympusInterface()
     {
         return (olympus);
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/camera/CameraStatusListener.java b/app/src/main/java/net/osdn/gokigen/a01d/camera/CameraStatusListener.java
new file mode 100644 (file)
index 0000000..90f3a84
--- /dev/null
@@ -0,0 +1,142 @@
+package net.osdn.gokigen.a01d.camera;
+
+import android.support.annotation.NonNull;
+import android.util.Log;
+
+import net.osdn.gokigen.a01d.camera.sony.wrapper.eventlistener.CameraChangeListerTemplate;
+import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
+
+public class CameraStatusListener extends CameraChangeListerTemplate implements ICameraStatusUpdateNotify
+{
+    private  final String TAG = toString();
+    private ICameraStatusUpdateNotify updateReceiver = null;
+
+
+    CameraStatusListener()
+    {
+        Log.v(TAG, "CameraStatusListener()");
+    }
+
+    void setUpdateReceiver(@NonNull ICameraStatusUpdateNotify receiver)
+    {
+        updateReceiver = receiver;
+    }
+
+    @Override
+    public void onFocusStatusChanged(String focusStatus)
+    {
+        Log.v(TAG, "onFocusStatusChanged() : " + focusStatus);
+        if ((focusStatus == null)||(updateReceiver == null))
+        {
+            Log.v(TAG, "focusStatus or updateReceiver is NULL.");
+            return;
+        }
+        switch (focusStatus)
+        {
+            case "Focused":
+                updateReceiver.updateFocusedStatus(true, true);
+                break;
+            case "Failed":
+                updateReceiver.updateFocusedStatus(false, true);
+                break;
+            case "Focusing":
+            case "Not Focusing":
+            default:
+                updateReceiver.updateFocusedStatus(false, false);
+                break;
+        }
+    }
+
+    @Override
+    public void updateDriveMode(String driveMode)
+    {
+        Log.v(TAG, "updateDriveMode() : " + driveMode);
+    }
+
+    @Override
+    public void updateAeLockState(boolean isAeLocked)
+    {
+
+    }
+
+    @Override
+    public void updateCameraStatus(String message)
+    {
+
+    }
+
+    @Override
+    public void updateLevelGauge(String orientation, float roll, float pitch)
+    {
+
+    }
+
+    @Override
+    public void updatedTakeMode(String mode)
+    {
+
+    }
+
+    @Override
+    public void updatedShutterSpeed(String tv)
+    {
+
+    }
+
+    @Override
+    public void updatedAperture(String av)
+    {
+
+    }
+
+    @Override
+    public void updatedExposureCompensation(String xv)
+    {
+
+    }
+
+    @Override
+    public void updatedMeteringMode(String meteringMode)
+    {
+
+    }
+
+    @Override
+    public void updatedWBMode(String wbMode)
+    {
+
+    }
+
+    @Override
+    public void updateRemainBattery(int percentage)
+    {
+
+    }
+
+    @Override
+    public void updateFocusedStatus(boolean focused, boolean focusLocked)
+    {
+        if (updateReceiver != null)
+        {
+            updateReceiver.updateFocusedStatus(focused, focusLocked);
+        }
+    }
+
+    @Override
+    public void updateIsoSensitivity(String sv)
+    {
+
+    }
+
+    @Override
+    public void updateWarning(String warning)
+    {
+
+    }
+
+    @Override
+    public void updateStorageStatus(String status)
+    {
+
+    }
+}
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/camera/ICameraStatus.java b/app/src/main/java/net/osdn/gokigen/a01d/camera/ICameraStatus.java
new file mode 100644 (file)
index 0000000..8f7f30c
--- /dev/null
@@ -0,0 +1,43 @@
+package net.osdn.gokigen.a01d.camera;
+
+import android.support.annotation.NonNull;
+
+import java.util.List;
+
+public interface ICameraStatus
+{
+    @NonNull List<String> getStatusList(@NonNull final String key);
+    String getStatus(@NonNull final String key);
+    void setStatus(@NonNull final String key, @NonNull final String value);
+
+    String BATTERY = "battery";
+    String STATE = "state";
+    String FOCUS_MODE = "focusMode";
+    String AF_MODE = "AFMode";
+
+    String RESOLUTION = "reso";
+    String DRIVE_MODE = "shootMode";
+    String WHITE_BALANCE = "WBMode";
+
+    String AE = "meteringMode";
+
+    String AE_STATUS_MULTI = "multi";
+    String AE_STATUS_ESP = "ESP";
+    String AE_STATUS_SPOT = "spot";
+    String AE_STATUS_PINPOINT = "Spot";
+    String AE_STATUS_CENTER = "center";
+    String AE_STATUS_CENTER2 = "Ctr-Weighted";
+
+    String EFFECT = "effect";
+    String TAKE_MODE = "exposureMode";
+    String IMAGESIZE = "stillSize";
+    String MOVIESIZE = "movieSize";
+
+    String APERATURE = "av";
+    String SHUTTER_SPEED = "tv";
+    String ISO_SENSITIVITY = "sv";
+    String EXPREV = "xv";
+    String FLASH_XV = "flashxv";
+
+    String TAKE_MODE_MOVIE = "movie";
+}
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/camera/ICameraStatusWatcher.java b/app/src/main/java/net/osdn/gokigen/a01d/camera/ICameraStatusWatcher.java
new file mode 100644 (file)
index 0000000..7530eb4
--- /dev/null
@@ -0,0 +1,11 @@
+package net.osdn.gokigen.a01d.camera;
+
+import android.support.annotation.NonNull;
+
+import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
+
+public interface ICameraStatusWatcher
+{
+    void startStatusWatch(@NonNull ICameraStatusUpdateNotify notifier);
+    void stopStatusWatch();
+}
index 7a9053f..8c770b6 100644 (file)
@@ -1,9 +1,12 @@
 package net.osdn.gokigen.a01d.camera;
 
+import android.support.annotation.NonNull;
+
 import net.osdn.gokigen.a01d.camera.olympus.wrapper.IOlympusLiveViewListener;
 import net.osdn.gokigen.a01d.camera.olympus.IOlympusInterfaceProvider;
 import net.osdn.gokigen.a01d.camera.ricohgr2.IRicohGr2InterfaceProvider;
 import net.osdn.gokigen.a01d.camera.sony.ISonyInterfaceProvider;
+import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
 
 /**
  *
@@ -16,5 +19,7 @@ public interface IInterfaceProvider
     ISonyInterfaceProvider getSonyInterface();
     IRicohGr2InterfaceProvider getRicohGr2Infterface();
 
+    void setUpdateReceiver(@NonNull ICameraStatusUpdateNotify receiver);
+
     ICameraConnection.CameraConnectionMethod getCammeraConnectionMethod();
 }
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/status/RicohGr2StatusChecker.java b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/status/RicohGr2StatusChecker.java
new file mode 100644 (file)
index 0000000..44c43a9
--- /dev/null
@@ -0,0 +1,246 @@
+package net.osdn.gokigen.a01d.camera.ricohgr2.status;
+
+import android.support.annotation.NonNull;
+import android.util.Log;
+
+import net.osdn.gokigen.a01d.camera.ICameraStatus;
+import net.osdn.gokigen.a01d.camera.ICameraStatusWatcher;
+import net.osdn.gokigen.a01d.camera.utils.SimpleHttpClient;
+import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RicohGr2StatusChecker implements ICameraStatusWatcher, ICameraStatus
+{
+    private final String TAG = toString();
+    private final String statusCheckUrl = "http://192.168.0.1/v1/props";
+    private final String statusSetUrl = "http://192.168.0.1/v1/params/camera";
+    private final String grCommandUrl = "http://192.168.0.1/_gr";
+    private final int sleepMs;
+
+    private final boolean useGrCommand;
+
+    private int timeoutMs = 5000;
+    private boolean whileFetching = false;
+    private RicohGr2StatusHolder statusHolder;
+
+    /**
+     *
+     *
+     */
+    RicohGr2StatusChecker(int sleepMs, boolean useGrCommand)
+    {
+        this.useGrCommand = useGrCommand;
+        this.sleepMs = sleepMs;
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void startStatusWatch(@NonNull ICameraStatusUpdateNotify notifier)
+    {
+        Log.v(TAG, "startStatusWatch()");
+        try
+        {
+            this.statusHolder = new RicohGr2StatusHolder(notifier);
+            Thread thread = new Thread(new Runnable()
+            {
+                @Override
+                public void run()
+                {
+                    try
+                    {
+                        start(statusCheckUrl);
+                    }
+                    catch (Exception e)
+                    {
+                        e.printStackTrace();
+                    }
+                }
+            });
+            thread.start();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     *
+     */
+    @Override
+    public void stopStatusWatch()
+    {
+        Log.v(TAG, "stoptStatusWatch()");
+        whileFetching = false;
+    }
+
+    /**
+     *
+     *
+     */
+    private void start(@NonNull final String watchUrl)
+    {
+        if (whileFetching)
+        {
+            Log.v(TAG, "start() already starting.");
+            return;
+        }
+
+        try
+        {
+            whileFetching = true;
+            Thread thread = new Thread(new Runnable()
+            {
+                @Override
+                public void run()
+                {
+                    Log.d(TAG, "Start status watch.");
+                    while (whileFetching)
+                    {
+                        try
+                        {
+                            statusHolder.updateStatus(SimpleHttpClient.httpGet(watchUrl, timeoutMs));
+                            Thread.sleep(sleepMs);
+                        }
+                        catch (Exception e)
+                        {
+                            e.printStackTrace();
+                        }
+                    }
+                    Log.v(TAG, "STATUS WATCH STOPPED.");
+                }
+            });
+            thread.start();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public @NonNull
+    List<String> getStatusList(@NonNull final String key)
+    {
+        try
+        {
+            if (statusHolder == null)
+            {
+                return (new ArrayList<>());
+            }
+            String listKey = key + "List";
+            return (statusHolder.getAvailableItemList(listKey));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (new ArrayList<>());
+    }
+
+    @Override
+    public String getStatus(@NonNull String key)
+    {
+        try
+        {
+            if (statusHolder == null)
+            {
+                return ("");
+            }
+            return (statusHolder.getItemStatus(key));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return ("");
+    }
+
+    @Override
+    public void setStatus(@NonNull final String key, @NonNull final String value)
+    {
+        Thread thread = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try
+                {
+                    String response;
+                    String postData = key + "=" + value;
+                    if ((useGrCommand)&&(key.equals("exposureMode")))
+                    {
+                        //  撮影モードを変更するときは、GR専用コマンドを送ることにする。
+                        postData = "cmd=" + decideButtonCode(value);
+                        response = SimpleHttpClient.httpPost(grCommandUrl, postData, timeoutMs);
+                        Log.v(TAG, "CHANGE MODE : " + postData + " resp. (" + response.length() + "bytes.)");
+                    } else {
+                        // 通常の変更コマンド
+                        response = SimpleHttpClient.httpPut(statusSetUrl, postData, timeoutMs);
+                        Log.v(TAG, "SET PROPERTY : " + postData + " resp. (" + response.length() + "bytes.)");
+                    }
+                    if (useGrCommand)
+                    {
+                        //  GR専用コマンドで、画面表示をリフレッシュ
+                        response = SimpleHttpClient.httpPost(grCommandUrl, "cmd=mode refresh", timeoutMs);
+                        Log.v(TAG, "refresh resp. (" + response.length() + "bytes.)");
+                    }
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+            }
+        });
+        try
+        {
+            thread.start();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *   撮影モードをGRのダイアルコマンドに変更する
+     *
+     */
+    private String decideButtonCode(String exposureMode)
+    {
+        String buttonCode = "bdial AUTO";
+        if (exposureMode == null)
+        {
+            return (buttonCode);
+        }
+        switch (exposureMode)
+        {
+            case "movie":
+                buttonCode = "bdial MOVIE";
+                break;
+            case "M":
+                buttonCode = "bdial M";
+                break;
+            case "TAV":
+                buttonCode = "bdial TAV";
+                break;
+            case "AV":
+                buttonCode = "bdial AV";
+                break;
+            case "TV":
+                buttonCode = "bdial TV";
+                break;
+            case "P":
+                buttonCode = "bdial P";
+                break;
+            case "auto":
+                buttonCode = "bdial AUTO";
+                break;
+        }
+        return (buttonCode);
+    }
+}
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/status/RicohGr2StatusHolder.java b/app/src/main/java/net/osdn/gokigen/a01d/camera/ricohgr2/status/RicohGr2StatusHolder.java
new file mode 100644 (file)
index 0000000..bd015cd
--- /dev/null
@@ -0,0 +1,186 @@
+package net.osdn.gokigen.a01d.camera.ricohgr2.status;
+
+import android.support.annotation.NonNull;
+import android.util.Log;
+
+import net.osdn.gokigen.a01d.liveview.ICameraStatusUpdateNotify;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RicohGr2StatusHolder
+{
+    private final String TAG = toString();
+    private final ICameraStatusUpdateNotify notifier;
+
+    private JSONObject latestResultObject = null;
+    private boolean focused = false;
+    private boolean focusLocked = false;
+    private String avStatus = "";
+    private String tvStatus = "";
+    private String xvStatus = "";
+    private String exposureModeStatus = "";
+    private String meteringModeStatus = "";
+    private String wbModeStatus = "";
+    private String batteryStatus = "";
+
+    /**
+     *
+     *
+     */
+    RicohGr2StatusHolder(ICameraStatusUpdateNotify notifier)
+    {
+        this.notifier = notifier;
+    }
+
+    /**
+     *
+     *
+     */
+    List<String> getAvailableItemList(@NonNull String key)
+    {
+        List<String> itemList = new ArrayList<>();
+        try
+        {
+            JSONArray array = latestResultObject.getJSONArray(key);
+            if (array == null)
+            {
+                return (itemList);
+            }
+            int nofItems = array.length();
+            for (int index = 0; index < nofItems; index++)
+            {
+                try
+                {
+                    itemList.add(array.getString(index));
+                }
+                catch (Exception e)
+                {
+                    e.printStackTrace();
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return (itemList);
+    }
+
+    String getItemStatus(@NonNull String key)
+    {
+        try
+        {
+            return (latestResultObject.getString(key));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return ("");
+    }
+
+    private String getStatusString(JSONObject obj, String name)
+    {
+        try
+        {
+            return (obj.getString(name));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return ("");
+    }
+
+    private boolean getBooleanStatus(JSONObject obj, String name)
+    {
+        try {
+            return (obj.getBoolean(name));
+        } catch (Exception e) {
+            //e.printStackTrace();
+        }
+        return (false);
+    }
+
+    /**
+     *
+     *
+     */
+    void updateStatus(String replyString)
+    {
+        if ((replyString == null)||(replyString.length() < 1))
+        {
+            Log.v(TAG, "httpGet() reply is null. ");
+            return;
+        }
+
+        try
+        {
+            latestResultObject = new JSONObject(replyString);
+            String result = getStatusString(latestResultObject,"errMsg");
+            String av = getStatusString(latestResultObject,"av");
+            String tv = getStatusString(latestResultObject,"tv");
+            String xv = getStatusString(latestResultObject,"xv");
+            String exposureMode = getStatusString(latestResultObject,"exposureMode");
+            String meteringMode = getStatusString(latestResultObject,"meteringMode");
+            String wbMode = getStatusString(latestResultObject,"WBMode");
+            String battery = getStatusString(latestResultObject,"battery");
+            boolean focus = getBooleanStatus(latestResultObject,"focused");
+            boolean focusLock = getBooleanStatus(latestResultObject,"focusLocked");
+
+            if (result.contains("OK"))
+            {
+                if (!avStatus.equals(av))
+                {
+                    avStatus = av;
+                    notifier.updatedAperture(avStatus);
+                }
+                if (!tvStatus.equals(tv))
+                {
+                    tvStatus = tv;
+                    notifier.updatedShutterSpeed(tvStatus);
+                }
+                if (!xvStatus.equals(xv))
+                {
+                    xvStatus = xv;
+                    notifier.updatedExposureCompensation(xvStatus);
+                }
+                if (!exposureModeStatus.equals(exposureMode))
+                {
+                    exposureModeStatus = exposureMode;
+                    notifier.updatedTakeMode(exposureModeStatus);
+                }
+                if (!meteringModeStatus.equals(meteringMode))
+                {
+                    meteringModeStatus = meteringMode;
+                    notifier.updatedMeteringMode(meteringModeStatus);
+                }
+                if (!wbModeStatus.equals(wbMode))
+                {
+                    wbModeStatus = wbMode;
+                    notifier.updatedWBMode(wbModeStatus);
+                }
+                if (!batteryStatus.equals(battery))
+                {
+                    batteryStatus = battery;
+                    notifier.updateRemainBattery(Integer.parseInt(batteryStatus));
+                }
+                if ((focus != focused)||(focusLock != focusLocked))
+                {
+                    focused = focus;
+                    focusLocked = focusLock;
+                    notifier.updateFocusedStatus(focused, focusLocked);
+                }
+            }
+            System.gc();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+}
index 5d0674b..3784058 100644 (file)
@@ -134,7 +134,11 @@ public class SonyAutoFocusControl
                         JSONObject resultsObj = (isPressed) ? cameraApi.actHalfPressShutter() : cameraApi.cancelHalfPressShutter();
                         if (resultsObj == null)
                         {
-                            Log.v(TAG, "lockAutoFocus() [" + isPressed + "] reply is null.");
+                            Log.v(TAG, "halfPressShutter() [" + isPressed + "] reply is null.");
+                        }
+                        else
+                        {
+                            indicator.onAfLockUpdate(isPressed);
                         }
                     }
                     catch (Exception e)
index b8b6b0b..cddcbba 100644 (file)
@@ -36,6 +36,7 @@ public class SonyCameraWrapper implements ISonyCameraHolder, ISonyInterfaceProvi
     private final String TAG = toString();
     private final Activity context;
     private final ICameraStatusReceiver provider;
+    private final ICameraChangeListener listener;
     private ISonyCamera sonyCamera = null;
     private ISonyCameraApi sonyCameraApi = null;
     private ICameraEventObserver eventObserver = null;
@@ -44,10 +45,11 @@ public class SonyCameraWrapper implements ISonyCameraHolder, ISonyInterfaceProvi
     private SonyCameraCaptureControl captureControl = null;
     private SonyCameraZoomLensControl zoomControl = null;
 
-    public SonyCameraWrapper(final Activity context, final ICameraStatusReceiver statusReceiver)
+    public SonyCameraWrapper(final Activity context, final ICameraStatusReceiver statusReceiver , final @NonNull ICameraChangeListener listener)
     {
         this.context = context;
         this.provider = statusReceiver;
+        this.listener = listener;
     }
 
     @Override
@@ -102,7 +104,7 @@ public class SonyCameraWrapper implements ISonyCameraHolder, ISonyInterfaceProvi
     @Override
     public ICameraConnection getSonyCameraConnection()
     {
-        return (new SonyCameraConnection(context, provider, this));
+        return (new SonyCameraConnection(context, provider, this, listener));
     }
 
     @Override
index 309f082..5d77a55 100644 (file)
@@ -10,6 +10,7 @@ import net.osdn.gokigen.a01d.camera.ICameraStatusReceiver;
 import net.osdn.gokigen.a01d.camera.sony.wrapper.ISonyCamera;
 import net.osdn.gokigen.a01d.camera.sony.wrapper.ISonyCameraHolder;
 import net.osdn.gokigen.a01d.camera.sony.wrapper.eventlistener.CameraChangeListerTemplate;
+import net.osdn.gokigen.a01d.camera.sony.wrapper.eventlistener.ICameraChangeListener;
 
 
 /**
@@ -23,15 +24,17 @@ public class SonyCameraConnectSequence implements Runnable, SonySsdpClient.ISear
     private final ICameraConnection cameraConnection;
     private final ISonyCameraHolder cameraHolder;
     private final ICameraStatusReceiver cameraStatusReceiver;
+    private final ICameraChangeListener listener;
     private final SonySsdpClient client;
 
-    SonyCameraConnectSequence(Activity context, ICameraStatusReceiver statusReceiver, final ICameraConnection cameraConnection, final @NonNull ISonyCameraHolder cameraHolder)
+    SonyCameraConnectSequence(Activity context, ICameraStatusReceiver statusReceiver, final ICameraConnection cameraConnection, final @NonNull ISonyCameraHolder cameraHolder, final @NonNull ICameraChangeListener listener)
     {
         Log.v(TAG, "SonyCameraConnectSequence");
         this.context = context;
         this.cameraConnection = cameraConnection;
         this.cameraStatusReceiver = statusReceiver;
         this.cameraHolder = cameraHolder;
+        this.listener = listener;
         client = new SonySsdpClient(context, this, statusReceiver, 1);
     }
 
@@ -78,7 +81,7 @@ public class SonyCameraConnectSequence implements Runnable, SonySsdpClient.ISear
                     try
                     {
                         cameraHolder.prepare();
-                        cameraHolder.startEventWatch(new CameraChangeListerTemplate());
+                        cameraHolder.startEventWatch(listener);
                     }
                     catch (Exception e)
                     {
index 22fab80..b659bd7 100644 (file)
@@ -18,6 +18,7 @@ import net.osdn.gokigen.a01d.R;
 import net.osdn.gokigen.a01d.camera.ICameraConnection;
 import net.osdn.gokigen.a01d.camera.ICameraStatusReceiver;
 import net.osdn.gokigen.a01d.camera.sony.wrapper.ISonyCameraHolder;
+import net.osdn.gokigen.a01d.camera.sony.wrapper.eventlistener.ICameraChangeListener;
 
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
@@ -35,16 +36,18 @@ public class SonyCameraConnection implements ICameraConnection
     private final ISonyCameraHolder cameraHolder;
     //private final ConnectivityManager connectivityManager;
     private final Executor cameraExecutor = Executors.newFixedThreadPool(1);
+    private final ICameraChangeListener listener;
     //private final Handler networkConnectionTimeoutHandler;
     //private static final int MESSAGE_CONNECTIVITY_TIMEOUT = 1;
     private CameraConnectionStatus connectionStatus = CameraConnectionStatus.UNKNOWN;
 
-    public SonyCameraConnection(final Activity context, final ICameraStatusReceiver statusReceiver, @NonNull ISonyCameraHolder cameraHolder)
+    public SonyCameraConnection(final Activity context, final ICameraStatusReceiver statusReceiver, @NonNull ISonyCameraHolder cameraHolder, final @NonNull ICameraChangeListener listener)
     {
         Log.v(TAG, "SonyCameraConnection()");
         this.context = context;
         this.statusReceiver = statusReceiver;
         this.cameraHolder = cameraHolder;
+        this.listener = listener;
 /*
         ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
         networkConnectionTimeoutHandler = new Handler()
@@ -264,7 +267,7 @@ public class SonyCameraConnection implements ICameraConnection
         connectionStatus = CameraConnectionStatus.CONNECTING;
         try
         {
-            cameraExecutor.execute(new SonyCameraConnectSequence(context,statusReceiver, this, cameraHolder));
+            cameraExecutor.execute(new SonyCameraConnectSequence(context,statusReceiver, this, cameraHolder, listener));
         }
         catch (Exception e)
         {
index a8fc8d0..abae3d6 100644 (file)
@@ -51,6 +51,12 @@ public class CameraChangeListerTemplate implements ICameraChangeListener
     }
 
     @Override
+    public void onFocusStatusChanged(String focusStatus)
+    {
+        Log.v(TAG, "onFocusStatusChanged() : " + focusStatus);
+    }
+
+    @Override
     public void onResponseError()
     {
         Log.v(TAG, "onResponseError() ");
index f16228e..10a5e6d 100644 (file)
@@ -22,7 +22,7 @@ public class CameraEventObserver implements ICameraEventObserver
 
     private final ISonyCameraApi remoteApi;
     private final ReplyJsonParser replyParser;
-    private final String eventVersion = "1.0";
+    private String eventVersion = "1.1";  // 初期値を "1.0" から "1.1" に更新
 
     public static ICameraEventObserver newInstance(@NonNull Context context, @NonNull ISonyCameraApi apiClient)
     {
@@ -81,6 +81,12 @@ public class CameraEventObserver implements ICameraEventObserver
                                     break;
                                 case 1: // "Any" error
                                 case 12: // "No such method" error
+                                    if (eventVersion.equals("1.1"))
+                                    {
+                                        // "1.1" でエラーが発生した時には "1.0" にダウングレードして再実行
+                                        eventVersion = "1.0";
+                                        continue MONITORLOOP;
+                                    }
                                     replyParser.fireResponseErrorListener();
                                     break MONITORLOOP; // end monitoring.
 
index aa3ee5a..5d1fec1 100644 (file)
@@ -14,5 +14,6 @@ public interface ICameraChangeListener
     void onShootModeChanged(String shootMode);
     void onZoomPositionChanged(int zoomPosition);
     void onStorageIdChanged(String storageId);
+    void onFocusStatusChanged(String focusStatus);
     void onResponseError();
 }
index c00a7e7..917449c 100644 (file)
@@ -23,6 +23,7 @@ public class ReplyJsonParser implements ICameraStatusHolder
     private List<String> currentAvailableShootModes = Collections.unmodifiableList(new ArrayList<String>());
     private int currentZoomPosition;
     private String currentStorageId;
+    private String currentFocusStatus;
 
     ReplyJsonParser(final @NonNull Handler uiHandler)
     {
@@ -81,6 +82,13 @@ public class ReplyJsonParser implements ICameraStatusHolder
             fireStorageIdChangeListener(storageId);
         }
 
+        // focusStatus (v1.1)
+        String focusStatus = findFocusStatus(replyJson);
+        Log.d(TAG, "getEvent focusStatus:" + focusStatus);
+        if (focusStatus != null && !focusStatus.equals(currentFocusStatus)) {
+            currentFocusStatus = focusStatus;
+            fireFocusStatusChangeListener(focusStatus);
+        }
     }
 
     void setEventChangeListener(ICameraChangeListener listener)
@@ -184,6 +192,17 @@ public class ReplyJsonParser implements ICameraStatusHolder
         });
     }
 
+    private void fireFocusStatusChangeListener(final String focusStatus) {
+        uiHandler.post(new Runnable() {
+            @Override
+            public void run() {
+                if (listener != null) {
+                    listener.onFocusStatusChanged(focusStatus);
+                }
+            }
+        });
+    }
+
     private static List<String> findAvailableApiList(JSONObject replyJson) {
         List<String> availableApis = new ArrayList<>();
         int indexOfAvailableApiList = 0;
@@ -343,6 +362,26 @@ public class ReplyJsonParser implements ICameraStatusHolder
         return (storageId);
     }
 
+    private static String findFocusStatus(JSONObject replyJson)
+    {
+        String focusStatus = null;
+        try {
+            int indexOfFocusStatus= 35;
+            JSONArray resultsObj = replyJson.getJSONArray("result");
+            if (!resultsObj.isNull(indexOfFocusStatus)) {
+                JSONObject focustatusObj = resultsObj.getJSONObject(indexOfFocusStatus);
+                String type = focustatusObj.getString("type");
+                if ("focusStatus".equals(type)) {
+                    focusStatus = focustatusObj.getString("focusStatus");
+                } else {
+                    Log.w(TAG, "Event reply: Illegal Index (21: ShootMode) " + type);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return (focusStatus);
+    }
 
     @Override
     public String getCameraStatus()
index 8c01312..cb432ac 100644 (file)
@@ -1,5 +1,8 @@
 package net.osdn.gokigen.a01d.camera.utils;
 
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.support.annotation.NonNull;
 import android.util.Log;
 
 import java.io.BufferedReader;
@@ -20,6 +23,7 @@ public class SimpleHttpClient
 {
     private static final String TAG = SimpleHttpClient.class.getSimpleName();
     private static final int DEFAULT_TIMEOUT = 10 * 1000; // [ms]
+    private static final int BUFFER_SIZE = 131072 * 2; // 256kB
 
     public SimpleHttpClient()
     {
@@ -123,8 +127,171 @@ public class SimpleHttpClient
      *
      *
      */
+    public static void httpGetBytes(String url, int timeoutMs, @NonNull IReceivedMessageCallback callback)
+    {
+        HttpURLConnection httpConn = null;
+        InputStream inputStream = null;
+        int timeout = timeoutMs;
+        if (timeoutMs < 0)
+        {
+            timeout = DEFAULT_TIMEOUT;
+        }
+
+        //  HTTP GETメソッドで要求を投げる
+        try
+        {
+            final URL urlObj = new URL(url);
+            httpConn = (HttpURLConnection) urlObj.openConnection();
+            httpConn.setRequestMethod("GET");
+            httpConn.setConnectTimeout(timeout);
+            httpConn.setReadTimeout(timeout);
+            httpConn.connect();
+
+            int responseCode = httpConn.getResponseCode();
+            if (responseCode == HttpURLConnection.HTTP_OK)
+            {
+                inputStream = httpConn.getInputStream();
+            }
+            if (inputStream == null)
+            {
+                Log.w(TAG, "httpGet: Response Code Error: " + responseCode + ": " + url);
+                callback.onErrorOccurred(new NullPointerException());
+                callback.onCompleted();
+                return;
+            }
+        }
+        catch (Exception e)
+        {
+            Log.w(TAG, "httpGet: " + url + "  " + e.getMessage());
+            e.printStackTrace();
+            if (httpConn != null)
+            {
+                httpConn.disconnect();
+            }
+            callback.onErrorOccurred(e);
+            callback.onCompleted();
+            return;
+        }
+
+        // 応答を確認する
+        try
+        {
+            int contentLength = httpConn.getContentLength();
+            byte[] buffer = new byte[BUFFER_SIZE];
+            int readBytes = 0;
+            int readSize = inputStream.read(buffer, 0, BUFFER_SIZE);
+            while (readSize != -1)
+            {
+                callback.onReceive(readBytes, contentLength, readSize, buffer);
+                readBytes += readSize;
+                readSize = inputStream.read(buffer, 0, BUFFER_SIZE);
+            }
+            Log.v(TAG, "RECEIVED " + readBytes + " BYTES. (contentLength : " + contentLength + ")");
+            inputStream.close();
+        }
+        catch (Exception e)
+        {
+            Log.w(TAG, "httpGet: exception: " + e.getMessage());
+            e.printStackTrace();
+            callback.onErrorOccurred(e);
+        }
+        finally
+        {
+            try
+            {
+                inputStream.close();
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        callback.onCompleted();
+    }
+
+    /**
+     *
+     *
+     *
+     */
+    public static Bitmap httpGetBitmap(String url, int timeoutMs)
+    {
+        HttpURLConnection httpConn = null;
+        InputStream inputStream = null;
+        Bitmap bmp = null;
+
+        int timeout = timeoutMs;
+        if (timeoutMs < 0)
+        {
+            timeout = DEFAULT_TIMEOUT;
+        }
+
+        //  HTTP GETメソッドで要求を投げる
+        try
+        {
+            final URL urlObj = new URL(url);
+            httpConn = (HttpURLConnection) urlObj.openConnection();
+            httpConn.setRequestMethod("GET");
+            httpConn.setConnectTimeout(timeout);
+            httpConn.setReadTimeout(timeout);
+            httpConn.connect();
+
+            int responseCode = httpConn.getResponseCode();
+            if (responseCode == HttpURLConnection.HTTP_OK)
+            {
+                inputStream = httpConn.getInputStream();
+                if (inputStream != null)
+                {
+                    bmp = BitmapFactory.decodeStream(inputStream);
+                }
+            }
+            if (inputStream == null)
+            {
+                Log.w(TAG, "httpGet: Response Code Error: " + responseCode + ": " + url);
+                return (null);
+            }
+            inputStream.close();
+        }
+        catch (Exception e)
+        {
+            Log.w(TAG, "httpGet: " + url + "  " + e.getMessage());
+            e.printStackTrace();
+            if (httpConn != null)
+            {
+                httpConn.disconnect();
+            }
+            return (null);
+        }
+        return (bmp);
+    }
+
+    /**
+     *
+     *
+     *
+     */
     public static String httpPost(String url, String postData, int timeoutMs)
     {
+        return (httpCommand(url, "POST", postData, timeoutMs));
+    }
+
+    /**
+     *
+     *
+     *
+     */
+    public static String httpPut(String url, String postData, int timeoutMs)
+    {
+        return (httpCommand(url, "PUT", postData, timeoutMs));
+    }
+
+    /**
+     *
+     *
+     *
+     */
+    private static String httpCommand(String url, String requestMethod, String postData, int timeoutMs)
+    {
         HttpURLConnection httpConn = null;
         OutputStream outputStream = null;
         OutputStreamWriter writer = null;
@@ -136,12 +303,12 @@ public class SimpleHttpClient
             timeout = DEFAULT_TIMEOUT;
         }
 
-        //  HTTP Postメソッドで要求を送出
+        //  HTTP メソッドで要求を送出
         try
         {
             final URL urlObj = new URL(url);
             httpConn = (HttpURLConnection) urlObj.openConnection();
-            httpConn.setRequestMethod("POST");
+            httpConn.setRequestMethod(requestMethod);
             httpConn.setConnectTimeout(timeout);
             httpConn.setReadTimeout(timeout);
             httpConn.setDoInput(true);
@@ -163,13 +330,13 @@ public class SimpleHttpClient
             }
             if (inputStream == null)
             {
-                Log.w(TAG, "httpPost: Response Code Error: " + responseCode + ": " + url);
+                Log.w(TAG, "http " + requestMethod + " : Response Code Error: " + responseCode + ": " + url);
                 return ("");
             }
         }
         catch (Exception e)
         {
-            Log.w(TAG, "httpPost: IOException: " + e.getMessage());
+            Log.w(TAG, "http " + requestMethod + " : IOException: " + e.getMessage());
             e.printStackTrace();
             if (httpConn != null)
             {
@@ -238,4 +405,11 @@ public class SimpleHttpClient
         }
         return (replyString);
     }
+
+    public interface IReceivedMessageCallback
+    {
+        void onCompleted();
+        void onErrorOccurred(Exception  e);
+        void onReceive(int readBytes, int length, int size, byte[] data);
+    }
 }
index 0c8e5ac..dd38152 100644 (file)
@@ -61,6 +61,7 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
     private IPreviewImageConverter bitmapConverter = null;
     private IMessageHolder messageHolder;
     private IStoreImage storeImage = null;
+    private IFocusLockIndicator focusLockIndicator = null;
 
     public CameraLiveImageView(Context context)
     {
@@ -151,6 +152,10 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
         return getIntrinsicContentSizeHeight();
     }
 
+    public void setFocuslockIndicator(IFocusLockIndicator focuslockIndicator)
+    {
+        focusLockIndicator = focuslockIndicator;
+    }
 
     private float getIntrinsicContentSizeWidth()
     {
@@ -996,7 +1001,11 @@ public class CameraLiveImageView extends View implements IImageDataReceiver, IAu
     @Override
     public void onAfLockUpdate(boolean isAfLocked)
     {
-        //Log.v(TAG, "onAfLockUpdate() : " + isAfLocked);
+        Log.v(TAG, "onAfLockUpdate() : " + isAfLocked);
+        if (focusLockIndicator != null)
+        {
+            focusLockIndicator.updateFocusLockIndicator(isAfLocked, isAfLocked);
+        }
     }
 
     @Override
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/liveview/ICameraStatusDisplay.java b/app/src/main/java/net/osdn/gokigen/a01d/liveview/ICameraStatusDisplay.java
deleted file mode 100644 (file)
index f4d49dc..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package net.osdn.gokigen.a01d.liveview;
-
-/**
- *
- */
-public interface ICameraStatusDisplay
-{
-    void updateTakeMode();
-    void updateDriveMode();
-    void updateWhiteBalance();
-    void updateBatteryLevel();
-    void updateAeMode();
-    void updateAeLockState();
-    void updateCameraStatus();
-    void updateCameraStatus(String message);
-    void updateLevelGauge(String orientation, float roll, float pitch);
-}
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/liveview/ICameraStatusUpdateNotify.java b/app/src/main/java/net/osdn/gokigen/a01d/liveview/ICameraStatusUpdateNotify.java
new file mode 100644 (file)
index 0000000..cda6670
--- /dev/null
@@ -0,0 +1,24 @@
+package net.osdn.gokigen.a01d.liveview;
+
+/**
+ *
+ */
+public interface ICameraStatusUpdateNotify
+{
+    void updateDriveMode(String driveMode);
+    void updateAeLockState(boolean isAeLocked);
+    void updateCameraStatus(String message);
+    void updateLevelGauge(String orientation, float roll, float pitch);
+
+    void updatedTakeMode(String mode);
+    void updatedShutterSpeed(String tv);
+    void updatedAperture(String av);
+    void updatedExposureCompensation(String xv);
+    void updatedMeteringMode(String meteringMode);
+    void updatedWBMode(String wbMode);
+    void updateRemainBattery(final int percentage);
+    void updateFocusedStatus(boolean focused, boolean focusLocked);
+    void updateIsoSensitivity(String sv);
+    void updateWarning(String warning);
+    void updateStorageStatus(String status);
+}
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/liveview/IFocusLockIndicator.java b/app/src/main/java/net/osdn/gokigen/a01d/liveview/IFocusLockIndicator.java
new file mode 100644 (file)
index 0000000..90ae671
--- /dev/null
@@ -0,0 +1,6 @@
+package net.osdn.gokigen.a01d.liveview;
+
+public interface IFocusLockIndicator
+{
+    void updateFocusLockIndicator(final boolean focused, final boolean focusLocked);
+}
index c803d3e..35f62c0 100644 (file)
@@ -9,4 +9,6 @@ public interface IStatusViewDrawer
     void updateStatusView(String message);
     void updateLiveViewScale(boolean isChangeScale);
     void startLiveView();
+
+    boolean isFocusLocked();
 }
index 74c5e9c..bbe2762 100644 (file)
@@ -256,9 +256,20 @@ class LiveViewClickTouchListener implements View.OnClickListener, View.OnTouchLi
      */
     private void actionFocusButton()
     {
-
-
-
+        try
+        {
+            // シャッターを半押しする
+            if (focusingControl != null)
+            {
+                boolean isHalfPress = !statusViewDrawer.isFocusLocked();
+                focusingControl.halfPressShutter(isHalfPress);
+                Log.v(TAG, " actionFocusButton() : isHalfPress " + isHalfPress);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
     }
 
     /**
index 62f34a2..84f516f 100644 (file)
@@ -3,11 +3,14 @@ package net.osdn.gokigen.a01d.liveview;
 import android.app.Activity;
 import android.content.Context;
 import android.content.SharedPreferences;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.content.res.ResourcesCompat;
+import android.support.v4.graphics.drawable.DrawableCompat;
 import android.support.v7.preference.PreferenceManager;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -39,7 +42,7 @@ import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
  *  撮影用ライブビュー画面
  *
  */
-public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFocusingModeNotify, IFavoriteSettingDialogKicker
+public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFocusingModeNotify, IFavoriteSettingDialogKicker, ICameraStatusUpdateNotify, IFocusLockIndicator
 {
     private final String TAG = this.toString();
     private static final int COMMAND_MY_PROPERTY = 0x00000100;
@@ -58,6 +61,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     private CameraLiveImageView imageView = null;
 
     private ImageView manualFocus = null;
+    private ImageView focusIndicator = null;
     private ImageButton showGrid = null;
     private ImageButton connectStatus = null;
     private Button changeLiveViewScale = null;
@@ -65,6 +69,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
     private boolean imageViewCreated = false;
     private View myView = null;
     private String messageValue = "";
+    private boolean focusLocked = false;
 
     private ICameraConnection.CameraConnectionStatus currentConnectionStatus =  ICameraConnection.CameraConnectionStatus.UNKNOWN;
 
@@ -145,14 +150,19 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             }
             imageView.setOnClickListener(onClickTouchListener);
             imageView.setOnTouchListener(onClickTouchListener);
+            imageView.setFocuslockIndicator(this);
 
             view.findViewById(R.id.show_preference_button).setOnClickListener(onClickTouchListener);
             view.findViewById(R.id.camera_property_settings_button).setOnClickListener(onClickTouchListener);
             view.findViewById(R.id.shutter_button).setOnClickListener(onClickTouchListener);
             view.findViewById(R.id.btn_zoomin).setOnClickListener(onClickTouchListener);
             view.findViewById(R.id.btn_zoomout).setOnClickListener(onClickTouchListener);
-            view.findViewById(R.id.focus_indicator).setOnClickListener(onClickTouchListener);
 
+            focusIndicator =  view.findViewById(R.id.focus_indicator);
+            if (focusIndicator != null)
+            {
+                focusIndicator.setOnClickListener(onClickTouchListener);
+            }
             manualFocus = view.findViewById(R.id.focusing_button);
             changeLiveViewScale = view.findViewById(R.id.live_view_scale_button);
 
@@ -161,6 +171,12 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             if (connectionMethod == ICameraConnection.CameraConnectionMethod.OPC)
             {
                 view.findViewById(R.id.show_favorite_settings_button).setOnClickListener(onClickTouchListener);
+
+                // OPCのときには、フォーカスインジケータのマークを消す。
+                if (focusIndicator != null)
+                {
+                    focusIndicator.setVisibility(View.INVISIBLE);
+                }
             }
             else
             {
@@ -189,13 +205,21 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
                     {
                         changeLiveViewScale.setVisibility(View.INVISIBLE);
                     }
+                    if (focusIndicator != null)
+                    {
+                        focusIndicator.setVisibility(View.VISIBLE);
+                    }
                 }
-                else // if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
+                else if (connectionMethod == ICameraConnection.CameraConnectionMethod.RICOH_GR2)
                 {
                     if (changeLiveViewScale != null)
                     {
                         changeLiveViewScale.setVisibility(View.VISIBLE);
                     }
+                    if (focusIndicator != null)
+                    {
+                        focusIndicator.setVisibility(View.INVISIBLE);
+                    }
                 }
             }
 
@@ -273,6 +297,7 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
             this.zoomLensControl = interfaceProvider.getOlympusInterface().getZoomLensControl();
             this.cameraInformation = interfaceProvider.getOlympusInterface().getCameraInformation();
         }
+        interfaceProvider.setUpdateReceiver(this);
     }
 
     /**
@@ -602,6 +627,17 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         }
     }
 
+
+    /**
+     *   フォーカスロック中かどうか
+     *
+     */
+    @Override
+    public boolean isFocusLocked()
+    {
+        return (this.focusLocked);
+    }
+
     /**
      *    測光モードをスポットに切り替える
      *
@@ -654,4 +690,144 @@ public class LiveViewFragment extends Fragment implements IStatusViewDrawer, IFo
         }
         activity.runOnUiThread(action);
     }
+
+    @Override
+    public void updateDriveMode(String driveMode)
+    {
+        Log.v(TAG, "updateDriveMode() : " + driveMode);
+    }
+
+    @Override
+    public void updateAeLockState(boolean isAeLocked)
+    {
+        Log.v(TAG, "updateAeLockState() : " + isAeLocked);
+    }
+
+    @Override
+    public void updateCameraStatus(String message)
+    {
+        Log.v(TAG, "updateCameraStatus() : " + message);
+    }
+
+    @Override
+    public void updateLevelGauge(String orientation, float roll, float pitch)
+    {
+        Log.v(TAG, "updateLevelGauge() : " + orientation + " roll : " + roll + "  pitch : " + pitch);
+    }
+
+    @Override
+    public void updatedTakeMode(String mode)
+    {
+        Log.v(TAG, "updatedTakeMode() : " + mode);
+    }
+
+    @Override
+    public void updatedShutterSpeed(String tv)
+    {
+        Log.v(TAG, "updatedShutterSpeed() : " + tv);
+    }
+
+    @Override
+    public void updatedAperture(String av)
+    {
+        Log.v(TAG, "updatedAperture() : " + av);
+    }
+
+    @Override
+    public void updatedExposureCompensation(String xv)
+    {
+        Log.v(TAG, "updatedExposureCompensation() : " + xv);
+    }
+
+    @Override
+    public void updatedMeteringMode(String meteringMode)
+    {
+        Log.v(TAG, "updatedExposureCompensation() : " + meteringMode);
+    }
+
+    @Override
+    public void updatedWBMode(String wbMode)
+    {
+        Log.v(TAG, "updatedWBMode() : " + wbMode);
+    }
+
+    @Override
+    public void updateRemainBattery(int percentage)
+    {
+        Log.v(TAG, "updateRemainBattery() : " + percentage);
+    }
+
+    @Override
+    public void updateFocusedStatus(final boolean focused, final boolean focusLocked)
+    {
+        Log.v(TAG, "updateFocusedStatus() : f: " + focused + " fl: " + focusLocked);
+        this.focusLocked = focusLocked;
+        Activity activity = getActivity();
+        if ((activity == null)||(focusIndicator == null)|| (focusIndicator.getVisibility() != View.VISIBLE))
+        {
+            Log.v(TAG, "updateFocusedStatus() : INVISIBLE");
+            return;
+        }
+
+        try
+        {
+            activity.runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+                    if (focused)
+                    {
+                        Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_center_focus_strong_black_24dp, null);
+                        if (icon != null)
+                        {
+                            DrawableCompat.setTint(icon, Color.GREEN);
+                            focusIndicator.setImageDrawable(icon);
+                        }
+                    }
+                    else
+                    {
+                        Drawable icon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_crop_free_black_24dp, null);
+                        if (icon != null)
+                        {
+                            int color = Color.BLACK;
+                            if (focusLocked)
+                            {
+                                color = Color.RED;
+                            }
+                            DrawableCompat.setTint(icon, color);
+                            focusIndicator.setImageDrawable(icon);
+                        }
+                    }
+                    focusIndicator.invalidate();
+                }
+            });
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void updateIsoSensitivity(String sv)
+    {
+        Log.v(TAG, "updateIsoSensitivity() : " + sv);
+    }
+
+    @Override
+    public void updateWarning(String warning)
+    {
+        Log.v(TAG, "updateWarning() : " + warning);
+    }
+
+    @Override
+    public void updateStorageStatus(String status)
+    {
+        Log.v(TAG, "updateStorageStatus() : " + status);
+    }
+
+    @Override
+    public void updateFocusLockIndicator(final boolean focused, final boolean focusLocked)
+    {
+        updateFocusedStatus(focused, focusLocked);
+    }
 }