OSDN Git Service

FUJIのモードでステータスを表示するようにした。
authorMRSa <mrsa@myad.jp>
Sat, 2 May 2020 04:43:36 +0000 (13:43 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 2 May 2020 04:43:36 +0000 (13:43 +0900)
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/IFujiXInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/FujiXInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/FujiXStatusChecker.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/FujiXStatusHolder.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/connection/FujiXCameraConnectSequence.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/values/IFujiXCameraProperties.java
app/src/main/java/net/osdn/gokigen/gr2control/camera/fuji_x/wrapper/values/IFujiXImageFormatMode.java

index 7262ffd..ec1f3f7 100644 (file)
@@ -46,7 +46,6 @@ public interface IFujiXInterfaceProvider
     IFujiXCommunication getLiveviewCommunication();
     IFujiXCommunication getAsyncEventCommunication();
     IFujiXCommunication getCommandCommunication();
-    ICameraStatusUpdateNotify getStatusListener();
     IFujiXCommandPublisher getCommandPublisher();
     void setAsyncEventReceiver(@NonNull IFujiXCommandCallback receiver);
 }
index 22d43f3..43bc1b1 100644 (file)
@@ -1,11 +1,9 @@
 package net.osdn.gokigen.gr2control.camera.fuji_x.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.gr2control.camera.ICameraButtonControl;
 import net.osdn.gokigen.gr2control.camera.ICameraConnection;
@@ -39,7 +37,6 @@ import net.osdn.gokigen.gr2control.liveview.IAutoFocusFrameDisplay;
 import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
 import net.osdn.gokigen.gr2control.liveview.IIndicatorControl;
 import net.osdn.gokigen.gr2control.liveview.liveviewlistener.ILiveViewListener;
-import net.osdn.gokigen.gr2control.preference.IPreferencePropertyAccessor;
 
 public class FujiXInterfaceProvider implements IFujiXInterfaceProvider, IDisplayInjector
 {
@@ -51,7 +48,6 @@ public class FujiXInterfaceProvider implements IFujiXInterfaceProvider, IDisplay
     private static final String CAMERA_IP = "192.168.0.1";
 
     private final Activity activity;
-    //private final ICameraStatusReceiver provider;
     private final FujiXCommandPublisher commandPublisher;
     private final FujiXLiveViewControl liveViewControl;
     private final FujiXAsyncResponseReceiver asyncReceiver;
@@ -73,22 +69,7 @@ public class FujiXInterfaceProvider implements IFujiXInterfaceProvider, IDisplay
      */
     public FujiXInterfaceProvider(@NonNull Activity context, @NonNull ICameraStatusReceiver provider)
     {
-        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
-        int communicationTimeoutMs;
-        try
-        {
-            communicationTimeoutMs = Integer.parseInt(preferences.getString(IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT, IPreferencePropertyAccessor.RICOH_GET_PICS_LIST_TIMEOUT_DEFAULT_VALUE)) * 1000;
-            if (communicationTimeoutMs < 5000)
-            {
-                communicationTimeoutMs = 5000;  // 最小値は 5000msとする。
-            }
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
         this.activity = context;
-        //this.provider = provider;
         this.commandPublisher = new FujiXCommandPublisher(CAMERA_IP, CONTROL_PORT);
         fujiXConnection = new FujiXConnection(context, provider, this);
         liveViewControl = new FujiXLiveViewControl(context, CAMERA_IP, STREAM_PORT);
@@ -109,7 +90,7 @@ public class FujiXInterfaceProvider implements IFujiXInterfaceProvider, IDisplay
     @Override
     public void injectDisplay(IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator, IFocusingModeNotify focusingModeNotify)
     {
-        Log.v(TAG, "injectDisplay()");
+        Log.v(TAG, " injectDisplay()");
         focusControl = new FujiXFocusingControl(activity, commandPublisher, frameDisplayer, indicator);
         captureControl = new FujiXCaptureControl(commandPublisher, frameDisplayer);
     }
@@ -219,12 +200,6 @@ public class FujiXInterfaceProvider implements IFujiXInterfaceProvider, IDisplay
     }
 
     @Override
-    public ICameraStatusUpdateNotify getStatusListener()
-    {
-        return statusChecker.getStatusListener();
-    }
-
-    @Override
     public IFujiXCommandPublisher getCommandPublisher()
     {
         return (commandPublisher);
index f105681..0d1944f 100644 (file)
@@ -27,7 +27,7 @@ public class FujiXStatusChecker implements ICameraStatusWatcher, ICameraStatus,
     private ICameraStatusUpdateNotify notifier = null;
     private FujiXStatusHolder statusHolder;
     private boolean whileFetching = false;
-    private boolean logcat = false;
+    private boolean logcat = true;
 
 
     FujiXStatusChecker(@NonNull Activity activity, @NonNull IFujiXCommandPublisher issuer)
@@ -65,13 +65,18 @@ public class FujiXStatusChecker implements ICameraStatusWatcher, ICameraStatus,
     {
         try
         {
-            logcat("receivedMessage : " + id + ", length: " + data.length);
+            if (logcat)
+            {
+                Log.v(TAG, " receivedMessage : " + id + ", length: " + data.length);
+            }
             if (data.length < STATUS_MESSAGE_HEADER_SIZE)
             {
-                Log.v(TAG, "received status length is short. (" + data.length + " bytes.)");
+                if (logcat)
+                {
+                    Log.v(TAG, "received status length is short. (" + data.length + " bytes.)");
+                }
                 return;
             }
-
             int nofStatus = (data[13] * 256) + data[12];
             int statusCount = 0;
             int index = STATUS_MESSAGE_HEADER_SIZE;
@@ -148,7 +153,7 @@ public class FujiXStatusChecker implements ICameraStatusWatcher, ICameraStatus,
     {
         if (whileFetching)
         {
-            Log.v(TAG, "startStatusWatch() already starting.");
+            Log.v(TAG, " startStatusWatch() already starting.");
             return;
         }
         try
@@ -161,7 +166,7 @@ public class FujiXStatusChecker implements ICameraStatusWatcher, ICameraStatus,
                 @Override
                 public void run()
                 {
-                    logcat("Start status watch. : " + sleepMs + "ms");
+                    Log.v(TAG, " Start status watch. : " + sleepMs + "ms");
                     while (whileFetching)
                     {
                         try
@@ -174,7 +179,7 @@ public class FujiXStatusChecker implements ICameraStatusWatcher, ICameraStatus,
                             e.printStackTrace();
                         }
                     }
-                    logcat("STATUS WATCH STOPPED.");
+                    Log.v(TAG, "STATUS WATCH STOPPED.");
                 }
             });
             thread.start();
@@ -198,11 +203,4 @@ public class FujiXStatusChecker implements ICameraStatusWatcher, ICameraStatus,
         return (this.notifier);
     }
 
-    private void logcat(String message)
-    {
-        if (logcat)
-        {
-            Log.v(TAG, message);
-        }
-    }
 }
index 39ca899..8949393 100644 (file)
@@ -4,25 +4,33 @@ import android.util.Log;
 import android.util.SparseIntArray;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.collection.SparseArrayCompat;
 
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXBatteryMode;
 import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXCameraProperties;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXFSSControl;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXFilmSimulation;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXFlashMode;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXFocusingMode;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXImageAspectMode;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXImageFormatMode;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXShootingMode;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXTimerMode;
+import net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXWhiteBalanceMode;
 import net.osdn.gokigen.gr2control.liveview.ICameraStatusUpdateNotify;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
-import static net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values.IFujiXCameraProperties.FOCUS_LOCK;
-
-class FujiXStatusHolder
-{
+class FujiXStatusHolder {
     private final String TAG = toString();
+    private static final boolean logcat = true;
     private SparseIntArray statusHolder;
     private SparseArrayCompat<String> statusNameArray;
 
-    FujiXStatusHolder()
-    {
+    FujiXStatusHolder() {
         statusHolder = new SparseIntArray();
         statusHolder.clear();
 
@@ -54,70 +62,616 @@ class FujiXStatusHolder
         statusNameArray.append(IFujiXCameraProperties.FOCUS_LOCK, IFujiXCameraProperties.FOCUS_LOCK_STR);
         statusNameArray.append(IFujiXCameraProperties.MOVIE_REMAINING_TIME, IFujiXCameraProperties.MOVIE_REMAINING_TIME_STR);
         statusNameArray.append(IFujiXCameraProperties.SHUTTER_SPEED, IFujiXCameraProperties.SHUTTER_SPEED_STR);
-        statusNameArray.append(IFujiXCameraProperties.IMAGE_ASPECT,IFujiXCameraProperties.IMAGE_ASPECT_STR);
+        statusNameArray.append(IFujiXCameraProperties.IMAGE_ASPECT, IFujiXCameraProperties.IMAGE_ASPECT_STR);
         statusNameArray.append(IFujiXCameraProperties.BATTERY_LEVEL_2, IFujiXCameraProperties.BATTERY_LEVEL_2_STR);
-
         statusNameArray.append(IFujiXCameraProperties.UNKNOWN_DF00, IFujiXCameraProperties.UNKNOWN_DF00_STR);
         statusNameArray.append(IFujiXCameraProperties.PICTURE_JPEG_COUNT, IFujiXCameraProperties.PICTURE_JPEG_COUNT_STR);
         statusNameArray.append(IFujiXCameraProperties.UNKNOWN_D400, IFujiXCameraProperties.UNKNOWN_D400_STR);
         statusNameArray.append(IFujiXCameraProperties.UNKNOWN_D401, IFujiXCameraProperties.UNKNOWN_D401_STR);
         statusNameArray.append(IFujiXCameraProperties.UNKNOWN_D52F, IFujiXCameraProperties.UNKNOWN_D52F_STR);
+        statusNameArray.append(IFujiXCameraProperties.UNKNOWN_D245, IFujiXCameraProperties.UNKNOWN_D245_STR);
+        statusNameArray.append(IFujiXCameraProperties.UNKNOWN_DF41, IFujiXCameraProperties.UNKNOWN_DF41_STR);
+        statusNameArray.append(IFujiXCameraProperties.UNKNOWN_DF26, IFujiXCameraProperties.UNKNOWN_DF26_STR);
+        statusNameArray.append(IFujiXCameraProperties.UNKNOWN_DF27, IFujiXCameraProperties.UNKNOWN_DF27_STR);
+    }
+
+    void updateValue(@Nullable ICameraStatusUpdateNotify notifier, int id, byte data0, byte data1, byte data2, byte data3) {
+        try
+        {
+            int value = ((((int) data3) & 0xff) << 24) + ((((int) data2) & 0xff) << 16) + ((((int) data1) & 0xff) << 8) + (((int) data0) & 0xff);
+            int currentValue = statusHolder.get(id, -1);
+            //logcat(String.format(Locale.US, " STATUS [id: 0x%04x] 0x%08x(%d) -> 0x%08x(%d)", id, currentValue, currentValue, value, value));
+            if ((notifier != null) && (currentValue != value))
+            {
+                statusHolder.put(id, value);
+                //logcat(String.format(Locale.US," STATUS UPDATE [id: 0x%04x] 0x%08x(%d) -> 0x%08x(%d)", id, currentValue, currentValue, value, value));
+                updateDetected(notifier, id, currentValue, value);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private void updateDetected(@NonNull ICameraStatusUpdateNotify notifier, int id, int previous, int current)
+    {
+        try
+        {
+            //String idName = statusNameArray.get(id, "Unknown");
+            //logcat(String.format(Locale.US, " << UPDATE STATUS >> id: 0x%04x[%s] 0x%08x(%d) -> 0x%08x(%d)", id, idName, previous, previous, current, current));
+            switch (id)
+            {
+                case IFujiXCameraProperties.FOCUS_LOCK:
+                    updateFocusedStatus(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.SHOOTING_MODE:
+                    updatedTakeMode(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.BATTERY_LEVEL:
+                case IFujiXCameraProperties.BATTERY_LEVEL_2:
+                    updateBatteryLevel(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.FOCUS_MODE:
+                    updateFocusMode(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.APERTURE:
+                    updateAperture(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.SHUTTER_SPEED:
+                    updateShutterSpeed(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.WHITE_BALANCE:
+                    updateWhiteBalance(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.EXPOSURE_COMPENSATION:
+                    updateExposureCompensation(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.ISO:
+                    updateIsoSensitivity(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.DEVICE_ERROR:
+                    updateDeviceError(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.SELF_TIMER:
+                    updateSelfTimer(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.SDCARD_REMAIN_SIZE:
+                    updateSdCardRemainSize(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.MOVIE_REMAINING_TIME:
+                    updateMovieRemainTime(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.FOCUS_POINT:
+                    updateFocusPoint(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.F_SS_CONTROL:
+                    updateFSSControl(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.IMAGE_ASPECT:
+                    updateImageAspect(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.FILM_SIMULATION:
+                    updateFilmSimulation(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.FLASH:
+                    updateFlashMode(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.IMAGE_FORMAT:
+                    updateImageFormat(notifier, previous, current);
+                    break;
+                case IFujiXCameraProperties.UNKNOWN_D245:
+                case IFujiXCameraProperties.UNKNOWN_DF41:
+                case IFujiXCameraProperties.UNKNOWN_DF26:
+                case IFujiXCameraProperties.UNKNOWN_DF27:
+                    updateUnknownValue(id, previous, current);
+                    break;
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private void updateImageFormat(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String value;
+        switch (current)
+        {
+            case IFujiXImageFormatMode.IMAGE_FORMAT_RAW:
+                value = "RAW";
+                break;
+            case IFujiXImageFormatMode.IMAGE_FORMAT_FINE:
+                value = "FINE";
+                break;
+            case IFujiXImageFormatMode.IMAGE_FORMAT_NORMAL:
+                value = "NORMAL";
+                break;
+            case IFujiXImageFormatMode.IMAGE_FORMAT_FINE_RAW:
+                value = "RAW+F";
+                break;
+            case IFujiXImageFormatMode.IMAGE_FORMAT_NORMAL_RAW:
+                value = "RAW+N";
+                break;
+            default:
+                value = "UNKNOWN : " + current;
+                break;
+        }
+        logcat(" Image Format : " + value);
+    }
+
+    private void updateFlashMode(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String value;
+        switch (current)
+        {
+            case IFujiXFlashMode.FLASH_AUTO:
+                value = "AUTO";
+                break;
+            case IFujiXFlashMode.FLASH_OFF:
+                value = "OFF";
+                break;
+            case IFujiXFlashMode.FLASH_FILL:
+                value = "FILL";
+                break;
+            case IFujiXFlashMode.FLASH_REDEYE_AUTO:
+                value = "REDEYE_AUTO";
+                break;
+            case IFujiXFlashMode.FLASH_REDEYE_FILL:
+                value = "REDEYE_FILL";
+                break;
+            case IFujiXFlashMode.FLASH_EXTERNAL_SYNC:
+                value = "EXTERNAL_SYNC";
+                break;
+            case IFujiXFlashMode.FLASH_ON:
+                value = "ON";
+                break;
+            case IFujiXFlashMode.FLASH_REDEYE:
+                value = "REDEYE";
+                break;
+            case IFujiXFlashMode.FLASH_REDEYE_ON:
+                value = "REDEYE_ON";
+                break;
+            case IFujiXFlashMode.FLASH_REDEYE_SYNC:
+                value = "REDEYE_SYNC";
+                break;
+            case IFujiXFlashMode.FLASH_REDEYE_REAR:
+                value = "REDEYE_REAR";
+                break;
+            case IFujiXFlashMode.FLASH_SLOW_SYNC:
+                value = "SLOW_SYNC";
+                break;
+            case IFujiXFlashMode.FLASH_REAR_SYNC:
+                value = "REAR_SYNC";
+                break;
+            case IFujiXFlashMode.FLASH_COMMANDER:
+                value = "COMMANDER";
+                break;
+            case IFujiXFlashMode.FLASH_DISABLE:
+                value = "DISABLE";
+                break;
+            case IFujiXFlashMode.FLASH_ENABLE:
+                value = "ENABLE";
+                break;
+            default:
+                value = " UNKNOWN : " + current;
+                break;
+        }
+        logcat(" FLASH MODE : " + value);
+    }
+
+    private void updateFilmSimulation(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String value;
+        switch (current)
+        {
+            case IFujiXFilmSimulation.FILM_SIMULATION_PROVIA:
+                value = "PROVIA";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_VELVIA:
+                value = "VELVIA";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_ASTIA:
+                value = "ASTIA";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_MONOCHROME:
+                value = "MONO";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_SEPIA:
+                value = "SEPIA";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_PRO_NEG_HI:
+                value = "NEG_HI";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_PRO_NEG_STD:
+                value = "NEG_STD";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_MONOCHROME_Y_FILTER:
+                value = "MONO_Y";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_MONOCHROME_R_FILTER:
+                value = "MONO_R";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_MONOCHROME_G_FILTER:
+                value = "MONO_G";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_CLASSIC_CHROME:
+                value = "CLASSIC CHROME";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_ACROS:
+                value = "ACROS";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_ACROS_Y:
+                value = "ACROS_Y";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_ACROS_R:
+                value = "ACROS_R";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_ACROS_G:
+                value = "ACROS_G";
+                break;
+            case IFujiXFilmSimulation.FILM_SIMULATION_ETERNA:
+                value = "ETERNA";
+                break;
+            default:
+                value = "??? " + current;
+                break;
+        }
+        logcat(" FILM SIMULATION : " + value);
+    }
+
+    private void updateImageAspect(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String value;
+        switch (current)
+        {
+            case IFujiXImageAspectMode.IMAGE_ASPECT_S_3x2:
+              value = "S:3x2";
+              break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_S_16x9:
+              value = "S:16x9";
+              break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_S_1x1:
+              value = "S:1x1";
+              break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_M_3x2:
+                value = "M:3x2";
+                break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_M_16x9:
+                value = "M:16x9";
+                break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_M_1x1:
+                value = "M:1x1";
+                break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_L_3x2:
+                value = "L:3x2";
+                break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_L_16x9:
+                value = "L:16x9";
+                break;
+            case IFujiXImageAspectMode.IMAGE_ASPECT_L_1x1:
+                value = "L:1x1";
+                break;
+            default:
+                value = "? " + current;
+                break;
+        }
+        logcat("  Image Aspect : " + value);
+    }
+
+
+    private void updateFSSControl(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String value;
+        switch (current)
+        {
+            case IFujiXFSSControl.F_SS_CTRL_BOTH:
+                value = "BOTH";
+                break;
+            case IFujiXFSSControl.F_SS_CTRL_F:
+                value = "F";
+                break;
+            case IFujiXFSSControl.F_SS_CTRL_SS:
+                value = "SS";
+                break;
+            case IFujiXFSSControl.F_SS_CTRL_NONE:
+                value = "NONE";
+                break;
+            default:
+                value = "? " + current;
+                break;
+        }
+        logcat(" F_SS : " + value);
+    }
 
+    private void updateUnknownValue(int id, int previous, int current)
+    {
+        logcat(String.format(Locale.US,"<< UPDATE UNKNOWN STATUS >> id: 0x%04x 0x%08x(%d) -> 0x%08x(%d)", id, previous, previous, current, current));
+    }
 
+    private void updateFocusPoint(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        logcat(String.format(Locale.ENGLISH, " Focus Point : %x ", current));
     }
 
+    private void updateMovieRemainTime(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        logcat(" MOVIE REMAIN : " + current);
+    }
 
-    void updateValue(ICameraStatusUpdateNotify notifier, int id, byte data0, byte data1, byte data2, byte data3)
+    private void updateSdCardRemainSize(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
     {
+        logcat(" SDCARD REMAIN : " + current);
+    }
+
+    private void updateSelfTimer(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        int value = -1;
         try
         {
-            int value = ((((int) data3) & 0xff) << 24) + ((((int) data2) & 0xff) << 16) + ((((int) data1) & 0xff) << 8) + (((int) data0) & 0xff);
-            int currentValue = statusHolder.get(id, -1);
-            //Log.v(TAG, "STATUS  ID: " + id + "  value : " + value + " (" + currentValue + ")");
-            statusHolder.put(id, value);
-            if (currentValue != value)
+            switch (current)
             {
-                //Log.v(TAG, "STATUS  ID: " + id + " value : " + currentValue + " -> " + value);
-                if (notifier != null)
-                {
-                    updateDetected(notifier, id, currentValue, value);
-                }
+                case IFujiXTimerMode.TIMER_OFF:
+                    value = 0;
+                    break;
+
+                case IFujiXTimerMode.TIMER_1SEC:
+                    value = 1;
+                    break;
+
+                case IFujiXTimerMode.TIMER_2SEC:
+                    value = 2;
+                    break;
+
+                case IFujiXTimerMode.TIMER_5SEC:
+                    value = 5;
+                    break;
+
+                case IFujiXTimerMode.TIMER_10SEC:
+                    value = 10;
+                    break;
+
+                default:
+                    break;
             }
         }
         catch (Exception e)
         {
             e.printStackTrace();
         }
+        if (value <= 0)
+        {
+            logcat(" SELF TIMER IS OFF (" + value + ")");
+        }
+        else
+        {
+            logcat(" SELF TIMER IS " + value + " sec.");
+        }
     }
 
-    private void updateDetected(@NonNull ICameraStatusUpdateNotify notifier, int id, int previous, int current)
+    private void updateDeviceError(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        if (current != 0)
+        {
+            notifier.updateWarning("ERROR " + current);
+        }
+    }
+
+    private void updateIsoSensitivity(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String iso = "";
+        try
+        {
+            iso = "" + (0x0000ffff & current);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        notifier.updateIsoSensitivity(iso);
+    }
+
+    private void updateExposureCompensation(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
     {
+        String exposureCompensation = "";
         try
         {
-            String idName = statusNameArray.get(id, "Unknown");
-            Log.v(TAG, String.format(Locale.US,"<< UPDATE STATUS >> id: 0x%04x[%s] 0x%08x(%d) -> 0x%08x(%d)", id, idName, previous, previous, current, current));
-            //Log.v(TAG, "updateDetected(ID: " + id + " [" + idName + "] " + previous + " -> " + current + " )");
+            float value = ((float) current / 1000.0f);
+            exposureCompensation = String.format(Locale.ENGLISH, "%+1.1f", value);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        notifier.updatedExposureCompensation(exposureCompensation);
+    }
 
-            if (id == FOCUS_LOCK)
+    private void updateWhiteBalance(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String value = "";
+        try
+        {
+            switch (current)
             {
-                if (current == 1)
-                {
-                    // focus Lock
-                    notifier.updateFocusedStatus(true, true);
-                }
-                else
-                {
-                    // focus unlock
-                    notifier.updateFocusedStatus(false, false);
-                }
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_AUTO:
+                    value = "Auto";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_FINE:
+                    value = "Fine";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_INCANDESCENT:
+                    value = "Incandescent";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_FLUORESCENT_1:
+                    value = "Fluorescent 1";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_FLUORESCENT_2:
+                    value = "Fluorescent 2";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_FLUORESCENT_3:
+                    value = "Fluorescent 3";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_SHADE:
+                    value = "Shade";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_UNDERWATER:
+                    value = "Underwater";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_TEMPERATURE:
+                    value = "Kelvin";
+                    break;
+                case IFujiXWhiteBalanceMode.WHITE_BALANCE_CUSTOM:
+                    value = "Custom";
+                    break;
+                default:
+                    value = "Unknown";
+                    break;
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        notifier.updatedWBMode(value);
+    }
+
+    private void updateShutterSpeed(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String shutterSpeed = "--";
+        try
+        {
+            if ((0x80000000 & current) != 0)
+            {
+                int value = 0x0fffffff & current;
+                shutterSpeed = ("1/" + (value / 1000));
             }
+            else
+            {
+                shutterSpeed = (current + "");
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        notifier.updatedShutterSpeed(shutterSpeed);
+    }
+
+    private void updateAperture(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String aperature = "---";
+        try
+        {
+            float value = ((float) current / 100.0f);
+            aperature = String.format(Locale.ENGLISH, "%1.1f", value);
         }
         catch (Exception e)
         {
             e.printStackTrace();
         }
+        notifier.updatedAperture(aperature);
+    }
+
+    private void updateFocusMode(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String mode = "";
+
+        // Focus Mode
+        if (current == IFujiXFocusingMode.FOCUS_MANUAL)
+        {
+            mode = "MF";
+        }
+        else if (current == IFujiXFocusingMode.FOCUS_CONTINUOUS_AUTO)
+        {
+            mode = "AF-C";
+        }
+        else if (current == IFujiXFocusingMode.FOCUS_SINGLE_AUTO)
+        {
+            mode = "AF-S";
+        }
+        else
+        {
+            mode = mode + current;
+        }
+        logcat("  Focus Mode : " + mode);
+    }
+
+    private void updateFocusedStatus(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        if (current == 1)
+        {
+            // focus Lock
+            notifier.updateFocusedStatus(true, true);
+        }
+        else
+        {
+            // focus unlock
+            notifier.updateFocusedStatus(false, false);
+        }
+    }
+
+    private void updatedTakeMode(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        String mode = "";
+        switch (current)
+        {
+            case IFujiXShootingMode.SHOOTING_MANUAL:
+                mode = "M";
+                break;
+            case IFujiXShootingMode.SHOOTING_PROGRAM:
+                mode = "P";
+                break;
+            case IFujiXShootingMode.SHOOTING_APERTURE:
+                mode = "A";
+                break;
+            case IFujiXShootingMode.SHOOTING_SHUTTER:
+                mode = "S";
+                break;
+            case IFujiXShootingMode.SHOOTING_CUSTOM:
+                mode = "C";
+                break;
+            case IFujiXShootingMode.SHOOTING_AUTO:
+                mode = "a";
+                break;
+            default:
+                mode = mode + current;
+                break;
+        }
+        notifier.updatedTakeMode(mode);
     }
 
+    private void updateBatteryLevel(@NonNull ICameraStatusUpdateNotify notifier, int previous, int current)
+    {
+        int level;
+        if ((current == IFujiXBatteryMode.BATTERY_CRITICAL) || (current == IFujiXBatteryMode.BATTERY_126S_CRITICAL))
+        {
+            level = 0;
+        }
+        else if (current == IFujiXBatteryMode.BATTERY_126S_ONE_BAR)
+        {
+            level = 20;
+        }
+        else if ((current == IFujiXBatteryMode.BATTERY_ONE_BAR) || (current == IFujiXBatteryMode.BATTERY_126S_TWO_BAR))
+        {
+            level = 40;
+        }
+        else if (current == IFujiXBatteryMode.BATTERY_126S_THREE_BAR)
+        {
+            level = 60;
+        }
+        else if ((current == IFujiXBatteryMode.BATTERY_TWO_BAR) || (current == IFujiXBatteryMode.BATTERY_126S_FOUR_BAR))
+        {
+            level = 80;
+        }
+        else // if ((current == IFujiXBatteryMode.BATTERY_FULL) || (current == IFujiXBatteryMode.BATTERY_126S_FULL))
+        {
+            level = 100;
+        }
+        notifier.updateRemainBattery(level);
+    }
+
+
     /**
      *   認識したカメラのステータス名称のリストを応答する
      *
@@ -179,8 +733,8 @@ class FujiXStatusHolder
                 {
                     int id = Integer.parseInt(key, 16);
                     int value = statusHolder.get(id);
-                    Log.v(TAG, "getItemStatus() value : " + value + " key : " + key + " [" + id + "]");
-                    dumpStatus();
+                    logcat("getItemStatus() value : " + value + " key : " + key + " [" + id + "]");
+                    // dumpStatus();
                     return (value + "");
                 }
                 catch (Exception e)
@@ -224,8 +778,13 @@ class FujiXStatusHolder
         {
             e.printStackTrace();
         }
-
     }
 
-
+    private void logcat(String message)
+    {
+        if (logcat)
+        {
+            Log.v(TAG, message);
+        }
+    }
 }
index 76fecbb..d6a7b8c 100644 (file)
@@ -220,7 +220,7 @@ public class FujiXCameraConnectSequence implements Runnable, IFujiXCommandCallba
             Thread.sleep(1000);
             cameraStatusReceiver.onStatusNotify(context.getString(R.string.connect_connected));
             interfaceProvider.getAsyncEventCommunication().connect();
-            interfaceProvider.getCameraStatusWatcher().startStatusWatch(interfaceProvider.getStatusListener());
+            //interfaceProvider.getCameraStatusWatcher().startStatusWatch(interfaceProvider.getStatusListener());
             onConnectNotify();
         }
         catch (Exception e)
index 809bbdf..600e9bb 100644 (file)
@@ -4,7 +4,7 @@ public interface IFujiXCameraProperties
 {
     int BATTERY_LEVEL         = 0x5001;
     int WHITE_BALANCE         = 0x5005;
-    int APERTURE               = 0x5007;
+    int APERTURE              = 0x5007;
     int FOCUS_MODE            = 0x500a;
     int SHOOTING_MODE         = 0x500e;
     int FLASH                 = 0x500c;
@@ -19,18 +19,21 @@ public interface IFujiXCameraProperties
     int FOCUS_POINT           = 0xd17c;
     int FOCUS_LOCK            = 0xd209;
     int DEVICE_ERROR          = 0xd21b;
-    int IMAGE_FILE_COUNT = 0xd222;
+    int IMAGE_FILE_COUNT      = 0xd222;
     int SDCARD_REMAIN_SIZE    = 0xd229;
     int MOVIE_REMAINING_TIME  = 0xd22a;
     int SHUTTER_SPEED         = 0xd240;
     int IMAGE_ASPECT          = 0xd241;
     int BATTERY_LEVEL_2       = 0xd242;
-    int UNKNOWN_DF00             = 0xdf00;
-    int PICTURE_JPEG_COUNT = 0xd220;
-    int UNKNOWN_D400             = 0xd400;
-    int UNKNOWN_D401             = 0xd401;
-    int UNKNOWN_D52F             = 0xd52f;
-
+    int UNKNOWN_DF00          = 0xdf00;
+    int PICTURE_JPEG_COUNT    = 0xd220;
+    int UNKNOWN_D400          = 0xd400;
+    int UNKNOWN_D401          = 0xd401;
+    int UNKNOWN_D52F          = 0xd52f;
+    int UNKNOWN_D245          = 0xd245;
+    int UNKNOWN_DF41          = 0xdf41;
+    int UNKNOWN_DF26          = 0xdf26;
+    int UNKNOWN_DF27          = 0xdf27;
 
 
     String BATTERY_LEVEL_STR         = "Battery";
@@ -62,6 +65,10 @@ public interface IFujiXCameraProperties
     String UNKNOWN_D400_STR             = "0xd400";
     String UNKNOWN_D401_STR             = "0xd401";
     String UNKNOWN_D52F_STR             = "0xd52f";
+    String UNKNOWN_D245_STR             = "0xd245";
+    String UNKNOWN_DF41_STR             = "0xdf41";
+    String UNKNOWN_DF26_STR             = "0xdf26";
+    String UNKNOWN_DF27_STR             = "0xdf27";
 
 
     String BATTERY_LEVEL_STR_ID         = "0x5001";
@@ -81,17 +88,21 @@ public interface IFujiXCameraProperties
     String FOCUS_POINT_STR_ID           = "0xd17c";
     String FOCUS_LOCK_STR_ID            = "0xd209";
     String DEVICE_ERROR_STR_ID          = "0xd21b";
-    String IMAGE_FILE_COUNT_STR_ID = "0xd222";
+    String IMAGE_FILE_COUNT_STR_ID      = "0xd222";
     String SDCARD_REMAIN_SIZE_STR_ID    = "0xd229";
     String MOVIE_REMAINING_TIME_STR_ID  = "0xd22a";
     String SHUTTER_SPEED_STR_ID         = "0xd240";
     String IMAGE_ASPECT_STR_ID          = "0xd241";
     String BATTERY_LEVEL_2_STR_ID       = "0xd242";
 
-    String UNKNOWN_DF00_STR_ID             = "0xdf00";
-    String PICTURE_JPEG_COUNT_STR_ID = "0xd220";
-    String UNKNOWN_D400_STR_ID             = "0xd400";
-    String UNKNOWN_D401_STR_ID             = "0xd401";
-    String UNKNOWN_D52F_STR_ID             = "0xd52f";
+    String UNKNOWN_DF00_STR_ID          = "0xdf00";
+    String PICTURE_JPEG_COUNT_STR_ID    = "0xd220";
+    String UNKNOWN_D400_STR_ID          = "0xd400";
+    String UNKNOWN_D401_STR_ID          = "0xd401";
+    String UNKNOWN_D52F_STR_ID          = "0xd52f";
+    String UNKNOWN_D245_STR_ID          = "0xd245";
+    String UNKNOWN_DF41_STR_ID          = "0xdf41";
+    String UNKNOWN_DF26_STR_ID          = "0xdf26";
+    String UNKNOWN_DF27_STR_ID          = "0xdf27";
 
 }
index f55285c..3578764 100644 (file)
@@ -2,6 +2,7 @@ package net.osdn.gokigen.gr2control.camera.fuji_x.wrapper.values;
 
 public interface IFujiXImageFormatMode
 {
+    int IMAGE_FORMAT_RAW = 1;
     int IMAGE_FORMAT_FINE = 2;
     int IMAGE_FORMAT_NORMAL = 3;
     int IMAGE_FORMAT_FINE_RAW  = 4;