OSDN Git Service

Kodak PIXPRO WPZ2 の接続時にフラッシュモードを設定するようにした。
authorMRSa <mrsa@myad.jp>
Sat, 8 Aug 2020 13:17:02 +0000 (22:17 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 8 Aug 2020 13:17:02 +0000 (22:17 +0900)
14 files changed:
app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/operation/KodakFocusingControl.java
app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/wrapper/KodakInterfaceProvider.java
app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/wrapper/command/KodakCommandCommunicator.java
app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/wrapper/command/messages/IKodakMessages.java
app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/wrapper/command/messages/specific/KodakExecuteFocus.java [new file with mode: 0644]
app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/wrapper/connection/KodakCameraConnectSequence.java
app/src/main/java/net/osdn/gokigen/a01d/preference/IPreferencePropertyAccessor.java
app/src/main/java/net/osdn/gokigen/a01d/preference/kodak/KodakPreferenceFragment.java
app/src/main/java/net/osdn/gokigen/a01d/preference/summary/PreferenceFragmentSummary.java
app/src/main/res/values-ja/arrays.xml
app/src/main/res/values-ja/strings.xml
app/src/main/res/values/arrays.xml
app/src/main/res/values/strings.xml
app/src/main/res/xml/preferences_kodak.xml

index 4505261..de1c860 100644 (file)
@@ -1,72 +1,40 @@
 package net.osdn.gokigen.a01d.camera.kodak.operation;
 
-import android.app.Activity;
-import android.content.SharedPreferences;
+
 import android.graphics.PointF;
-import android.graphics.RectF;
 import android.util.Log;
 import android.view.MotionEvent;
 
 import androidx.annotation.NonNull;
-import androidx.preference.PreferenceManager;
 
 import net.osdn.gokigen.a01d.camera.IFocusingControl;
+import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.IKodakCommandCallback;
 import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.IKodakCommandPublisher;
-import net.osdn.gokigen.a01d.camera.ptpip.wrapper.command.IPtpIpCommandCallback;
+import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.specific.KodakExecuteFocus;
 
 import net.osdn.gokigen.a01d.liveview.IAutoFocusFrameDisplay;
-import net.osdn.gokigen.a01d.liveview.IIndicatorControl;
-import net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor;
 
-public class KodakFocusingControl implements IFocusingControl, IPtpIpCommandCallback
+
+public class KodakFocusingControl implements IFocusingControl, IKodakCommandCallback
 {
     private final String TAG = this.toString();
-    private static final int FOCUS_LOCK_PRE = 15;
-    private static final int FOCUS_LOCK = 16;
-    private static final int FOCUS_MOVE = 17;
-    private static final int FOCUS_UNLOCK = 18;
 
     //private final Activity context;
     private final IKodakCommandPublisher commandPublisher;
     private final IAutoFocusFrameDisplay frameDisplayer;
-    private final IIndicatorControl indicator;
+    //private final IIndicatorControl indicator;
 
-    private float maxPointLimitWidth;
-    private float maxPointLimitHeight;
-    private RectF preFocusFrameRect = null;
-    private boolean not_support_focus_lock = false;
-    private boolean isDumpLog = false;
+    //private RectF preFocusFrameRect = null;
+    //private boolean not_support_focus_lock = false;
+    //private boolean isDumpLog = false;
 
-    public KodakFocusingControl(@NonNull Activity context, @NonNull IKodakCommandPublisher commandPublisher, IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator)
+    //public KodakFocusingControl(@NonNull Activity context, @NonNull IKodakCommandPublisher commandPublisher, IAutoFocusFrameDisplay frameDisplayer, IIndicatorControl indicator)
+    public KodakFocusingControl(@NonNull IKodakCommandPublisher commandPublisher, IAutoFocusFrameDisplay frameDisplayer)
     {
         //this.context = context;
         this.commandPublisher = commandPublisher;
         this.frameDisplayer = frameDisplayer;
-        this.indicator = indicator;
-        try
-        {
-            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
-            String focusPoint = preferences.getString(IPreferencePropertyAccessor.NIKON_FOCUS_XY, IPreferencePropertyAccessor.NIKON_FOCUS_XY_DEFAULT_VALUE);
-            String[] focus = focusPoint.split(",");
-            if (focus.length == 2)
-            {
-                maxPointLimitWidth = Integer.parseInt(focus[0]);
-                maxPointLimitHeight = Integer.parseInt(focus[1]);
-            }
-            else
-            {
-                maxPointLimitWidth = 6000.0f;
-                maxPointLimitHeight = 4000.0f;
-            }
-            not_support_focus_lock = preferences.getBoolean(IPreferencePropertyAccessor.NIKON_NOT_SUPPORT_FOCUS_LOCK, false);
-            Log.v(TAG, "FOCUS RESOLUTION : " + maxPointLimitWidth + "," + maxPointLimitHeight + " FOCUS LOCK : " + not_support_focus_lock);
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            maxPointLimitWidth = 6000.0f;
-            maxPointLimitHeight = 4000.0f;
-        }
+        //this.indicator = indicator;
     }
 
     @Override
@@ -85,8 +53,8 @@ public class KodakFocusingControl implements IFocusingControl, IPtpIpCommandCall
                     PointF point = frameDisplayer.getPointWithEvent(motionEvent);
                     if (point != null)
                     {
-                        preFocusFrameRect = getPreFocusFrameRect(point);
-                        showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Running, 0.0);
+                        // preFocusFrameRect = getPreFocusFrameRect(point);
+                        // showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Running, 1.0);
                         if (frameDisplayer.isContainsPoint(point))
                         {
                             lockAutoFocus(point);
@@ -129,21 +97,19 @@ public class KodakFocusingControl implements IFocusingControl, IPtpIpCommandCall
     {
         //unlockAutoFocus();
         //commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_MOVE, isDumpLog, 0, 0x90c1));
-        //lockAutoFocus(new PointF(0.5f, 0.5f));
+        lockAutoFocus(new PointF(0.5f, 0.5f));
     }
 
     private void lockAutoFocus(PointF point)
     {
+        float maxPointLimitWidth = 1000000.0f;
+        float maxPointLimitHeight = 1000000.0f;
         try
         {
-            int x = (0x0000ffff & (Math.round(point.x * maxPointLimitWidth) + 1));
-            int y = (0x0000ffff & (Math.round(point.y * maxPointLimitHeight) + 1));
+            int x = (0x00ffffff & (Math.round(point.x * maxPointLimitWidth) + 1));
+            int y = (0x00ffffff & (Math.round(point.y * maxPointLimitHeight) + 1));
             Log.v(TAG, "Lock AF: [" + x + ","+ y + "]");
-            if (!not_support_focus_lock) {
-                //commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_LOCK, isDumpLog, 0, 0x9205, 8, x, y));
-            } else {
-                //commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_MOVE, isDumpLog, 0, 0x90c1));
-            }
+            commandPublisher.enqueueCommand(new KodakExecuteFocus(this, x, y));
         }
         catch (Exception e)
         {
@@ -151,10 +117,7 @@ public class KodakFocusingControl implements IFocusingControl, IPtpIpCommandCall
         }
     }
 
-    /**
-     *
-     *
-     */
+/*
     private RectF getPreFocusFrameRect(@NonNull PointF point)
     {
         float imageWidth =  frameDisplayer.getContentSizeWidth();
@@ -175,88 +138,22 @@ public class KodakFocusingControl implements IFocusingControl, IPtpIpCommandCall
                 point.x + focusWidth / 2.0f, point.y + focusHeight / 2.0f));
     }
 
-    /**
-     *
-     *
-     */
     private void showFocusFrame(RectF rect, IAutoFocusFrameDisplay.FocusFrameStatus status, double duration)
     {
         frameDisplayer.showFocusFrame(rect, status, duration);
         indicator.onAfLockUpdate(IAutoFocusFrameDisplay.FocusFrameStatus.Focused == status);
     }
 
-    /**
-     *
-     *
-     */
     private void hideFocusFrame()
     {
         frameDisplayer.hideFocusFrame();
         indicator.onAfLockUpdate(false);
     }
-
+*/
 
     @Override
     public void receivedMessage(int id, byte[] rx_body)
     {
-        try
-        {
-            if (rx_body.length < 10)
-            {
-                Log.v(TAG, " --- BODY LENGTH IS SHORT : FOCUS OPERATION ---");
-                hideFocusFrame();
-                preFocusFrameRect = null;
-                return;
-            }
-            int responseCode = (rx_body[8] & 0xff) + ((rx_body[9] & 0xff) * 256);
-            if (responseCode != 0x2001)
-            {
-                Log.v(TAG, String.format(" --- RECEIVED NG REPLY. : FOCUS OPERATION (0x%x) ---", responseCode));
-                hideFocusFrame();
-                preFocusFrameRect = null;
-                return;
-            }
-
-            if ((id == FOCUS_LOCK)||(id == FOCUS_LOCK_PRE))
-            {
-                Log.v(TAG, "FOCUS LOCKED");
-                //commandPublisher.enqueueCommand(new PtpIpCommandGeneric(this, FOCUS_MOVE, isDumpLog, 0, 0x90c1));  // OKのときは駆動
-                if (preFocusFrameRect != null)
-                {
-                    // showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Focused, 1.0);  // 1秒だけ表示
-                    showFocusFrame(preFocusFrameRect, IAutoFocusFrameDisplay.FocusFrameStatus.Focused, -1);
-                }
-            }
-            else if (id == FOCUS_MOVE)
-            {
-                Log.v(TAG, "FOCUS MOVED");
-                //if (preFocusFrameRect != null)
-                //{
-                //    hideFocusFrame();
-                //}
-            }
-            else // if (id == FOCUS_UNLOCK)
-            {
-                Log.v(TAG, "FOCUS UNLOCKED");
-                hideFocusFrame();
-            }
-            preFocusFrameRect = null;
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
-    }
-
-    @Override
-    public void onReceiveProgress(int currentBytes, int totalBytes, byte[] rx_body)
-    {
-        Log.v(TAG, " " + currentBytes + "/" + totalBytes);
-    }
-
-    @Override
-    public boolean isReceiveMulti()
-    {
-        return (false);
+        Log.v(TAG, " KodakFocusingControl::receivedMessage() : ");
     }
 }
index a14d020..f6d9817 100644 (file)
@@ -76,7 +76,8 @@ public class KodakInterfaceProvider implements IKodakInterfaceProvider, IDisplay
     {
         Log.v(TAG, "injectDisplay()");
         captureControl = new KodakCaptureControl(commandPublisher, frameDisplayer);
-        focusingControl = new KodakFocusingControl(activity, commandPublisher, frameDisplayer, indicator);
+        focusingControl = new KodakFocusingControl(commandPublisher, frameDisplayer);
+        //focusingControl = new KodakFocusingControl(activity, commandPublisher, frameDisplayer, indicator);
     }
 
     @Override
index 796486c..b9a06ca 100644 (file)
@@ -402,7 +402,7 @@ public class KodakCommandCommunicator implements IKodakCommandPublisher, IKodakC
         Log.v(TAG, "send_secondary_message : [" + received_body[8] + "] [" + received_body[9] + "] ");
         try {
             byte[] message_to_send = null;
-            if ((received_body[8] == (byte) 0xd2) && (received_body[9] == (byte) 0xd2)) {
+            if ((received_body[8] == (byte) 0xd2) && (received_body[9] == (byte) 0xd7)) {
                 message_to_send = new byte[]{
                         (byte) 0x2e, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                         (byte) 0xd2, (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x10, (byte) 0x00, (byte) 0x80,
@@ -415,7 +415,19 @@ public class KodakCommandCommunicator implements IKodakCommandPublisher, IKodakC
                         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                 };
             }
-
+            if ((received_body[8] == (byte) 0xb9) && (received_body[9] == (byte) 0x0b)) {
+                message_to_send = new byte[]{
+                        (byte) 0x2e , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00,
+                        (byte) 0xb9 , (byte) 0x0b , (byte) 0x00 , (byte) 0x00 , (byte) 0x01 , (byte) 0x10 , (byte) 0x00 , (byte) 0x80,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x01 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,
+                        (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+                };
+            }
             if ((received_body[8] == (byte) 0xba) && (received_body[9] == (byte) 0x0b)) {
                 message_to_send = new byte[]
                         {
@@ -478,6 +490,7 @@ public class KodakCommandCommunicator implements IKodakCommandPublisher, IKodakC
                 return (false);
             }
             if (((receive_body[8] == (byte) 0xd2)&&(receive_body[9] == (byte) 0x07))||
+                    ((receive_body[8] == (byte) 0xb9)&&(receive_body[9] == (byte) 0x0b))||
                     ((receive_body[8] == (byte) 0xba)&&(receive_body[9] == (byte) 0x0b))||
                     ((receive_body[8] == (byte) 0xbb)&&(receive_body[9] == (byte) 0x0b)))
 
index aa823ea..9e87ee2 100644 (file)
@@ -6,6 +6,7 @@ public interface IKodakMessages
     int SEQ_RECEIVE_ONLY = 1;
 
     int SEQ_SHUTTER = 10;
+    int SEQ_FOCUS = 11;
 
     int SEQ_FLASH_OFF = 20;
     int SEQ_FLASH_ON = 21;
diff --git a/app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/wrapper/command/messages/specific/KodakExecuteFocus.java b/app/src/main/java/net/osdn/gokigen/a01d/camera/kodak/wrapper/command/messages/specific/KodakExecuteFocus.java
new file mode 100644 (file)
index 0000000..643e20d
--- /dev/null
@@ -0,0 +1,65 @@
+package net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.specific;
+
+import androidx.annotation.Nullable;
+
+import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.IKodakCommandCallback;
+import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.KodakCommandBase;
+
+import static net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.IKodakMessages.SEQ_FOCUS;
+
+public class KodakExecuteFocus  extends KodakCommandBase
+{
+    private final IKodakCommandCallback callback;
+
+    private final byte data00;
+    private final byte data01;
+    private final byte data02;
+    private final byte data03;
+
+    private final byte data10;
+    private final byte data11;
+    private final byte data12;
+    private final byte data13;
+
+    public KodakExecuteFocus(@Nullable IKodakCommandCallback callback, int posX, int posY)
+    {
+        this.callback = callback;
+        data00 = ((byte) (0x000000ff & posX));
+        data01 = ((byte)((0x0000ff00 & posX) >> 8));
+        data02 = ((byte)((0x00ff0000 & posX) >> 16));
+        data03 = ((byte)((0xff000000 & posX) >> 24));
+
+        data10 = ((byte) (0x000000ff & posY));
+        data11 = ((byte)((0x0000ff00 & posY) >> 8));
+        data12 = ((byte)((0x00ff0000 & posY) >> 16));
+        data13 = ((byte)((0xff000000 & posY) >> 24));
+    }
+
+    @Override
+    public int getId()
+    {
+        return SEQ_FOCUS;
+    }
+
+    @Override
+    public byte[] commandBody()
+    {
+        return (new byte[]
+                {
+                        (byte) 0x2e , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x18 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0xf6 , (byte) 0x03 , (byte) 0x00 , (byte) 0x00 , (byte) 0x01 , (byte) 0x00 , (byte) 0x00 , (byte) 0x80 ,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x01 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x01 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x18 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,      data00 ,      data01 ,      data02 ,      data03 ,      data10 ,      data11 ,      data12 ,      data13 ,
+                        (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,
+                        (byte) 0xff , (byte) 0xff , (byte) 0xff , (byte) 0xff , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 , (byte) 0x00 ,
+                });
+    }
+
+    @Override
+    public IKodakCommandCallback responseCallback()
+    {
+        return (this.callback);
+    }
+}
index 3018fd2..f91cf70 100644 (file)
@@ -1,10 +1,12 @@
 package net.osdn.gokigen.a01d.camera.kodak.wrapper.connection;
 
 import android.app.Activity;
+import android.content.SharedPreferences;
 import android.graphics.Color;
 import android.util.Log;
 
 import androidx.annotation.NonNull;
+import androidx.preference.PreferenceManager;
 
 import net.osdn.gokigen.a01d.R;
 import net.osdn.gokigen.a01d.camera.ICameraConnection;
@@ -24,9 +26,14 @@ import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.connection.Ko
 import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.connection.KodakConnectSequence09;
 import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.connection.KodakConnectSequence10;
 import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.connection.KodakConnectSequence11;
+import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.specific.KodakFlashAuto;
 import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.specific.KodakFlashOff;
+import net.osdn.gokigen.a01d.camera.kodak.wrapper.command.messages.specific.KodakFlashOn;
 import net.osdn.gokigen.a01d.camera.kodak.wrapper.status.KodakStatusChecker;
 
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.KODAK_FLASH_MODE;
+import static net.osdn.gokigen.a01d.preference.IPreferencePropertyAccessor.KODAK_FLASH_MODE_DEFAULT_VALUE;
+
 public class KodakCameraConnectSequence implements Runnable, IKodakCommandCallback, IKodakMessages
 {
     private final String TAG = this.toString();
@@ -38,6 +45,8 @@ public class KodakCameraConnectSequence implements Runnable, IKodakCommandCallba
     private final IKodakCommandPublisher commandIssuer;
     private final KodakStatusChecker statusChecker;
 
+    private String flashMode = "OFF";
+
     KodakCameraConnectSequence(@NonNull Activity context, @NonNull ICameraStatusReceiver statusReceiver, @NonNull final ICameraConnection cameraConnection, @NonNull IKodakInterfaceProvider interfaceProvider, @NonNull KodakStatusChecker statusChecker)
     {
         Log.v(TAG, " KodakCameraConnectSequence");
@@ -54,6 +63,20 @@ public class KodakCameraConnectSequence implements Runnable, IKodakCommandCallba
     {
         try
         {
+            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+            if (preferences != null)
+            {
+                flashMode = preferences.getString(KODAK_FLASH_MODE, KODAK_FLASH_MODE_DEFAULT_VALUE);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            flashMode = "OFF";
+        }
+
+        try
+        {
             // カメラとTCP接続
             IKodakCommandPublisher issuer = interfaceProvider.getCommandPublisher();
             if (!issuer.isConnected())
@@ -139,7 +162,18 @@ public class KodakCameraConnectSequence implements Runnable, IKodakCommandCallba
                 break;
             case SEQ_CONNECT_11:
                 interfaceProvider.getInformationReceiver().updateMessage(context.getString(R.string.kodak_connect_connecting11), false, false, 0);
-                commandIssuer.enqueueCommand(new KodakFlashOff(this));
+                if (flashMode.contains("AUTO"))
+                {
+                    commandIssuer.enqueueCommand(new KodakFlashAuto(this));
+                }
+                else if (flashMode.contains("ON"))
+                {
+                    commandIssuer.enqueueCommand(new KodakFlashOn(this));
+                }
+                else
+                {
+                    commandIssuer.enqueueCommand(new KodakFlashOff(this));
+                }
                 break;
             case SEQ_FLASH_AUTO:
             case SEQ_FLASH_OFF:
index 49539cd..069d1d9 100644 (file)
@@ -102,7 +102,8 @@ public interface IPreferencePropertyAccessor
 
     String SEND_MESSAGE_DIALOG = "dialog_message_send";
 
-
+    String KODAK_FLASH_MODE = "kodak_flash_mode";
+    String KODAK_FLASH_MODE_DEFAULT_VALUE = "OFF";
 
  /*
     int CHOICE_SPLASH_SCREEN = 10;
index ea995a4..922f169 100644 (file)
@@ -123,6 +123,10 @@ public class KodakPreferenceFragment extends PreferenceFragmentCompat implements
             if (!items.containsKey(IPreferencePropertyAccessor.CONNECTION_METHOD)) {
                 editor.putString(IPreferencePropertyAccessor.CONNECTION_METHOD, IPreferencePropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE);
             }
+            if (!items.containsKey(IPreferencePropertyAccessor.KODAK_FLASH_MODE))
+            {
+                editor.putString(IPreferencePropertyAccessor.KODAK_FLASH_MODE, IPreferencePropertyAccessor.KODAK_FLASH_MODE_DEFAULT_VALUE);
+            }
             editor.apply();
         }
         catch (Exception e)
@@ -175,17 +179,17 @@ public class KodakPreferenceFragment extends PreferenceFragmentCompat implements
             //super.onCreate(savedInstanceState);
             addPreferencesFromResource(R.xml.preferences_kodak);
 
-            ListPreference connectionMethod = findPreference(IPreferencePropertyAccessor.CONNECTION_METHOD);
-            if (connectionMethod != null)
+            ListPreference flashMode = findPreference(IPreferencePropertyAccessor.KODAK_FLASH_MODE);
+            if (flashMode != null)
             {
-                connectionMethod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
+                flashMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
                     @Override
                     public boolean onPreferenceChange(Preference preference, Object newValue) {
                         preference.setSummary(newValue + " ");
                         return (true);
                     }
                 });
-                connectionMethod.setSummary(connectionMethod.getValue() + " ");
+                flashMode.setSummary(flashMode.getValue() + " ");
             }
 
             Preference exitApplication = findPreference("exit_application");
@@ -193,12 +197,13 @@ public class KodakPreferenceFragment extends PreferenceFragmentCompat implements
             {
                 exitApplication.setOnPreferenceClickListener(powerOffController);
             }
-
+/*
             Preference httpDialog = findPreference(SEND_MESSAGE_DIALOG);
             if (httpDialog != null)
             {
                 httpDialog.setOnPreferenceClickListener(this);
             }
+*/
         }
         catch (Exception e)
         {
index fdf45ae..1034755 100644 (file)
@@ -150,6 +150,10 @@ public class PreferenceFragmentSummary extends PreferenceFragmentCompat implemen
             {
                 editor.putString(IPreferencePropertyAccessor.NUMBER_OF_CACHE_PICTURES, IPreferencePropertyAccessor.NUMBER_OF_CACHE_PICTURES_DEFAULT_VALUE);
             }
+            if (!items.containsKey(IPreferencePropertyAccessor.KODAK_FLASH_MODE))
+            {
+                editor.putString(IPreferencePropertyAccessor.KODAK_FLASH_MODE, IPreferencePropertyAccessor.KODAK_FLASH_MODE_DEFAULT_VALUE);
+            }
             editor.apply();
         }
         catch (Exception e)
index cc5d8a1..cac6e68 100644 (file)
         <item >3</item>
     </string-array>
 
+    <string-array name="kodak_flash_mode">
+        <item>OFF</item>
+        <item>ON</item>
+        <item>AUTO</item>
+    </string-array>
+
+    <string-array name="kodak_flash_mode_value">
+        <item>OFF</item>
+        <item>ON</item>
+        <item>AUTO</item>
+    </string-array>
+
 </resources>
index 54962db..9dbdc53 100644 (file)
 
     <string name="pref_open_send_command_dialog">メッセージ送信</string>
 
+    <string name="pref_kodak_flash_mode">フラッシュモード</string>
+    <string name="pref_summary_kodak_flash_mode">現在は、カメラと接続する時に設定します。</string>
+
 </resources>
index f91b57b..a522a52 100644 (file)
         <item >3</item>
     </string-array>
 
+    <string-array name="kodak_flash_mode">
+        <item>OFF</item>
+        <item>ON</item>
+        <item>AUTO</item>
+    </string-array>
+
+    <string-array name="kodak_flash_mode_value">
+        <item>OFF</item>
+        <item>ON</item>
+        <item>AUTO</item>
+    </string-array>
 
 </resources>
index 1cb1381..2c0e249 100644 (file)
 
     <string name="pref_open_send_command_dialog">SEND COMMAND DIALOG</string>
 
+    <string name="pref_kodak_flash_mode">Flash Mode</string>
+    <string name="pref_summary_kodak_flash_mode">Currently, sets only when connecting to camera.</string>
+
 </resources>
index a5fdcb5..ad93293 100644 (file)
 -->
     </PreferenceCategory>
 
-<!--
     <PreferenceCategory
         android:title="@string/pref_cat_camera">
 
-        <CheckBoxPreference
-            android:key="capture_both_camera_and_live_view"
-            android:title="@string/pref_capture_both_camera_and_live_view" />
+        <ListPreference
+            android:key="kodak_flash_mode"
+            android:title="@string/pref_kodak_flash_mode"
+            android:summary="@string/pref_summary_kodak_flash_mode"
+            android:entryValues="@array/kodak_flash_mode_value"
+            android:entries="@array/kodak_flash_mode"
+            android:defaultValue="OFF"
+            />
 
     </PreferenceCategory>
 
+<!--
     <PreferenceCategory
         android:title="@string/pref_cat_initialize">