OSDN Git Service

Thetaのオプション設定をすこし整理と追加。
authorMRSa <mrsa@myad.jp>
Fri, 15 Jan 2021 15:54:12 +0000 (00:54 +0900)
committerMRSa <mrsa@myad.jp>
Fri, 15 Jan 2021 15:54:12 +0000 (00:54 +0900)
wear/src/main/java/jp/sfjp/gokigen/a01c/ICameraStatusUpdateNotify.java [deleted file]
wear/src/main/java/jp/sfjp/gokigen/a01c/ICameraStatusWatcher.java
wear/src/main/java/jp/sfjp/gokigen/a01c/MainActivity.java
wear/src/main/java/jp/sfjp/gokigen/a01c/thetacamerawrapper/ThetaCameraController.kt
wear/src/main/java/jp/sfjp/gokigen/a01c/thetacamerawrapper/ThetaFeatureDispatcher.kt
wear/src/main/java/jp/sfjp/gokigen/a01c/thetacamerawrapper/operation/ThetaOptionUpdateControl.kt
wear/src/main/java/jp/sfjp/gokigen/a01c/thetacamerawrapper/status/ICameraStatus.java
wear/src/main/java/jp/sfjp/gokigen/a01c/thetacamerawrapper/status/ThetaCameraStatusWatcher.kt
wear/src/main/res/values/arrays.xml

diff --git a/wear/src/main/java/jp/sfjp/gokigen/a01c/ICameraStatusUpdateNotify.java b/wear/src/main/java/jp/sfjp/gokigen/a01c/ICameraStatusUpdateNotify.java
deleted file mode 100644 (file)
index bde4e8b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-package jp.sfjp.gokigen.a01c;
-
-/**
- *
- */
-public interface ICameraStatusUpdateNotify
-{
-    void updateCameraStatus(final String message);
-    void updatedExposureCompensation(String xv);
-    void updateRemainBattery(final double percentage);
-    void updateCaptureMode(final String message);
-
-/*
-    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 updatedMeteringMode(String meteringMode);
-    void updatedWBMode(String wbMode);
-    void updateFocusedStatus(boolean focused, boolean focusLocked);
-    void updateIsoSensitivity(String sv);
-    void updateWarning(String warning);
-    void updateStorageStatus(String status);
-*/
-}
index 256838c..d7e41f1 100644 (file)
@@ -4,7 +4,6 @@ import androidx.annotation.NonNull;
 
 public interface ICameraStatusWatcher
 {
-    void prepareStatusWatch();
-    void startStatusWatch(@NonNull ICameraStatusUpdateNotify notifier);
+    void startStatusWatch();
     void stopStatusWatch();
 }
index 053b285..554a1be 100644 (file)
@@ -37,7 +37,7 @@ import jp.sfjp.gokigen.a01c.thetacamerawrapper.ThetaCameraController;
  *   メインのActivity
  *
  */
-public class MainActivity extends AppCompatActivity implements  IChangeScene, IShowInformation, ICameraStatusReceiver, IDialogDismissedNotifier, ICameraStatusUpdateNotify
+public class MainActivity extends AppCompatActivity implements  IChangeScene, IShowInformation, ICameraStatusReceiver, IDialogDismissedNotifier
 {
     private final String TAG = toString();
     static final int REQUEST_NEED_PERMISSIONS = 1010;
@@ -532,8 +532,7 @@ public class MainActivity extends AppCompatActivity implements  IChangeScene, IS
             ICameraStatusWatcher watcher = currentCoordinator.getStatusWatcher();
             if (watcher != null)
             {
-                watcher.prepareStatusWatch();
-                watcher.startStatusWatch(this);
+                watcher.startStatusWatch();
             }
         }
         catch (Exception e)
@@ -946,65 +945,4 @@ public class MainActivity extends AppCompatActivity implements  IChangeScene, IS
             }
         });
     }
-
-    @Override
-    public void updateCaptureMode(String message)
-    {
-        try
-        {
-            setMessage(IShowInformation.AREA_1, Color.WHITE, message);
-        }
-        catch (Exception ee)
-        {
-            ee.printStackTrace();
-        }
-    }
-
-    @Override
-    public void updateCameraStatus(String message)
-    {
-        try
-        {
-            setMessage(IShowInformation.AREA_5, Color.WHITE, message);
-        }
-        catch (Exception ee)
-        {
-            ee.printStackTrace();
-        }
-    }
-
-    @Override
-    public void updatedExposureCompensation(String xv)
-    {
-        try
-        {
-            setMessage(IShowInformation.AREA_6, Color.WHITE, xv);
-        }
-        catch (Exception ee)
-        {
-            ee.printStackTrace();
-        }
-    }
-
-    @Override
-    public void updateRemainBattery(double percentageDouble)
-    {
-        int color = Color.YELLOW;
-        if (percentageDouble < 0.5d)
-        {
-            if (percentageDouble < 0.3d)
-            {
-                color = Color.RED;
-            }
-            try
-            {
-                int percentage = (int) Math.ceil(percentageDouble * 100.0d);
-                setMessage(IShowInformation.AREA_7, color, "Bat: " + percentage + "%");
-            }
-            catch (Exception ee)
-            {
-                ee.printStackTrace();
-            }
-        }
-    }
 }
index 329ae25..38f94da 100644 (file)
@@ -35,7 +35,7 @@ class ThetaCameraController(val context: AppCompatActivity, private val focusFra
     private val singleShot = ThetaSingleShotControl(sessionIdHolder, this, this)
     private val movieShot = ThetaMovieRecordingControl(context, sessionIdHolder, this, showInformation, this)
     private val optionSet = ThetaOptionUpdateControl(sessionIdHolder)
-    private val statusWatcher = ThetaCameraStatusWatcher(this, this)
+    private val statusWatcher = ThetaCameraStatusWatcher(this, this, showInformation)
     private var takeMode = "P"
 
     override fun connectFinished()
@@ -260,7 +260,7 @@ class ThetaCameraController(val context: AppCompatActivity, private val focusFra
     {
         if (!(::featureDispatcher.isInitialized))
         {
-            featureDispatcher = ThetaFeatureDispatcher(context, statusDrawer, camera, accessWrapper, liveImageView, optionSet, sessionIdHolder.isApiLevelV21(), this)
+            featureDispatcher = ThetaFeatureDispatcher(context, statusDrawer, camera, accessWrapper, liveImageView, optionSet, this, this)
         }
         return (featureDispatcher)
     }
index 8039e72..a2c2bc5 100644 (file)
@@ -13,9 +13,12 @@ import jp.sfjp.gokigen.a01c.olycamerawrapper.property.IOlyCameraProperty
 import jp.sfjp.gokigen.a01c.olycamerawrapper.takepicture.IBracketingShotStyle
 import jp.sfjp.gokigen.a01c.thetacamerawrapper.operation.ThetaOptionUpdateControl
 
-class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: IShowInformation, val camera: ICameraController, private val preferences: PreferenceDataStore, val liveImageView: ILiveImageStatusNotify, val optionSet : ThetaOptionUpdateControl, val useOSCv2 : Boolean, val statusHolder : IThetaStatusHolder): ICameraFeatureDispatcher
+class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: IShowInformation, val camera: ICameraController, private val preferences: PreferenceDataStore, val liveImageView: ILiveImageStatusNotify, val optionSet : ThetaOptionUpdateControl, val statusHolder : IThetaStatusHolder, val sessionIdProvider : IThetaSessionIdProvider): ICameraFeatureDispatcher
 {
-    private var exposureCompensation : Int = 6
+    private var exposureCompensationIndex : Int = 6
+    private var exposureProgramIndex : Int = 1
+    private var thetaFilterModeIndex : Int = 0
+    private var thetaWhiteBalanceIndex : Int = 0
 
     /**
      * 指定した機能を実行する
@@ -54,9 +57,16 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
                 changeExposureBiasValueDown()
             ICameraFeatureDispatcher.FEATURE_EXPOSURE_BIAS_UP ->                   // 露出補正を1段階上げる
                 changeExposureBiasValueUp()
+            ICameraFeatureDispatcher.FEATURE_SHOW_FAVORITE_DIALOG ->               // FILTER MODE (SHOW_FAVORITE_DIALOG)
+                changeFilterMode()
+            ICameraFeatureDispatcher.FEATURE_CHAGE_AE_LOCK_MODE ->                 // Exposure Program(AE LOCKのON/OFF切り替え)
+                changeExposureProgram()
+            ICameraFeatureDispatcher.FEATURE_WB_DOWN ->                            // ホワイトバランスを選択
+                changeWhiteBalanceDown()
+            ICameraFeatureDispatcher.FEATURE_WB_UP ->                              // ホワイトバランスを選択
+                changeWhiteBalanceUp()
+
 /*
-            ICameraFeatureDispatcher.FEATURE_CHAGE_AE_LOCK_MODE ->                 // AE LOCKのON/OFF切り替え
-                changeAeLockMode()
             ICameraFeatureDispatcher.FEATURE_APERTURE_DOWN ->                      // 絞り値を1段階下げる
                 changeApertureValueDown()
             ICameraFeatureDispatcher.FEATURE_APERTURE_UP ->                        // 絞り値を1段階上げる
@@ -83,10 +93,6 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
                 changeIsoSensitivityDown()
             ICameraFeatureDispatcher.FEATURE_ISO_UP ->                 // ISO感度を選択
                 changeIsoSensitivityUp()
-            ICameraFeatureDispatcher.FEATURE_WB_DOWN ->                 // ホワイトバランスを選択
-                changeWhiteBalanceDown()
-            ICameraFeatureDispatcher.FEATURE_WB_UP ->                 // ホワイトバランスを選択
-                changeWhiteBalanceUp()
             ICameraFeatureDispatcher.FEATURE_QUALITY_MOVIE_DOWN ->                 // 動画撮影クオリティを選択
                 changeMovieQualityModeDown()
             ICameraFeatureDispatcher.FEATURE_QUALITY_MOVIE_UP ->                 // 動画撮影クオリティを選択
@@ -247,6 +253,50 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
     }
 
     /**
+     *   フィルター
+     *
+     */
+    private fun changeFilterMode()
+    {
+        try
+        {
+            thetaFilterModeIndex++
+            if (thetaFilterModeIndex > MAX_FILTER_SELECTION)
+            {
+                thetaFilterModeIndex = 0
+            }
+            val optionStr = context.resources.getStringArray(R.array.theta_filter_set_value)[thetaFilterModeIndex]
+            optionSet.setOptions(optionStr, sessionIdProvider.sessionId.isEmpty())
+        }
+        catch (e : Exception)
+        {
+            e.printStackTrace()
+        }
+    }
+
+    /**
+     *   Exposure Program
+     *
+     */
+    private fun changeExposureProgram()
+    {
+        try
+        {
+            exposureProgramIndex++
+            if (exposureProgramIndex > MAX_EXPOSURE_PROGRAM)
+            {
+                exposureProgramIndex = 0
+            }
+            val optionStr = context.resources.getStringArray(R.array.exposure_program_value)[exposureProgramIndex]
+            optionSet.setOptions(optionStr, sessionIdProvider.sessionId.isEmpty())
+        }
+        catch (e : Exception)
+        {
+            e.printStackTrace()
+        }
+    }
+
+    /**
      * AF/MFの切り替えを行う
      */
     private fun toggleAfMf()
@@ -306,12 +356,12 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
     {
         try
         {
-            if (exposureCompensation > 0)
+            if (exposureCompensationIndex > 0)
             {
-                exposureCompensation--
+                exposureCompensationIndex--
 
-                val optionStr = context.resources.getStringArray(R.array.exposure_compensation_value)[exposureCompensation]
-                optionSet.setOptions(optionStr, useOSCv2)
+                val optionStr = context.resources.getStringArray(R.array.exposure_compensation_value)[exposureCompensationIndex]
+                optionSet.setOptions(optionStr, sessionIdProvider.sessionId.isEmpty())
             }
         }
         catch (e : Exception)
@@ -328,12 +378,12 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
     {
         try
         {
-            if (exposureCompensation < MAX_EXPOSURE_COMPENSATION)
+            if (exposureCompensationIndex < MAX_EXPOSURE_COMPENSATION)
             {
-                exposureCompensation++
+                exposureCompensationIndex++
 
-                val optionStr = context.resources.getStringArray(R.array.exposure_compensation_value)[exposureCompensation]
-                optionSet.setOptions(optionStr, useOSCv2)
+                val optionStr = context.resources.getStringArray(R.array.exposure_compensation_value)[exposureCompensationIndex]
+                optionSet.setOptions(optionStr, sessionIdProvider.sessionId.isEmpty())
             }
         }
         catch (e : Exception)
@@ -477,8 +527,20 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
      */
     private fun changeWhiteBalanceDown()
     {
-        val propertyProxy = camera.cameraPropertyProvider
-        propertyProxy.updateCameraPropertyDown(IOlyCameraProperty.WB_MODE)
+        try
+        {
+            if (thetaWhiteBalanceIndex > 0)
+            {
+                thetaWhiteBalanceIndex--
+
+                val optionStr = context.resources.getStringArray(R.array.white_balance_value)[thetaWhiteBalanceIndex]
+                optionSet.setOptions(optionStr, sessionIdProvider.sessionId.isEmpty())
+            }
+        }
+        catch (e : Exception)
+        {
+            e.printStackTrace()
+        }
     }
 
     /**
@@ -487,8 +549,20 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
      */
     private fun changeWhiteBalanceUp()
     {
-        val propertyProxy = camera.cameraPropertyProvider
-        propertyProxy.updateCameraPropertyUp(IOlyCameraProperty.WB_MODE)
+        try
+        {
+            if (thetaWhiteBalanceIndex < MAX_WHITE_BALANCE)
+            {
+                thetaWhiteBalanceIndex++
+
+                val optionStr = context.resources.getStringArray(R.array.white_balance_value)[thetaWhiteBalanceIndex]
+                optionSet.setOptions(optionStr, sessionIdProvider.sessionId.isEmpty())
+            }
+        }
+        catch (e : Exception)
+        {
+            e.printStackTrace()
+        }
     }
 
     /**
@@ -682,5 +756,9 @@ class ThetaFeatureDispatcher(val context: AppCompatActivity, val statusDrawer: I
         private val TAG = ThetaFeatureDispatcher::class.java.simpleName
 
         private const val MAX_EXPOSURE_COMPENSATION = 12 // exposureCompensation
+        private const val MAX_EXPOSURE_PROGRAM = 4 // exposureProgram
+        private const val MAX_FILTER_SELECTION = 4 // _filter
+        private const val MAX_WHITE_BALANCE = 11 // whiteBalance
+
     }
 }
index 527be36..cf3d33a 100644 (file)
@@ -15,15 +15,15 @@ class ThetaOptionUpdateControl(private val sessionIdProvider: IThetaSessionIdPro
      */
     fun setOptions(options: String, useOSCv2: Boolean, callBack: IOperationCallback? = null)
     {
-        Log.v(TAG, "setOptions() useOSCv2 : $useOSCv2  MSG : $options")
+        Log.v(TAG, "setOptions() OSCv2:$useOSCv2 MSG : $options")
         try
         {
             val thread = Thread {
                 try
                 {
                     val setOptionsUrl = "http://192.168.1.1/osc/commands/execute"
-                    val postData = if (useOSCv2) "{\"name\":\"camera.setOptions\",\"parameters\":{\"timeout\":0, \"options\": {\"$options\"}}}" else "{\"name\":\"camera.setOptions\",\"parameters\":{\"sessionId\": \"" + sessionIdProvider.sessionId + "\", \"options\": { $options }}}"
-                    Log.v(TAG, " OPTIONS : $postData")
+                    val postData = if (useOSCv2) "{\"name\":\"camera.setOptions\",\"parameters\":{\"timeout\":0, \"options\": {$options}}}" else "{\"name\":\"camera.setOptions\",\"parameters\":{\"sessionId\": \"" + sessionIdProvider.sessionId + "\", \"options\": { $options }}}"
+                    // Log.v(TAG, " OPTIONS : $postData")
                     val result: String? = httpClient.httpPostWithHeader(setOptionsUrl, postData, null, "application/json;charset=utf-8", timeoutMs)
                     if ((result != null) && (result.isNotEmpty()))
                     {
@@ -32,7 +32,7 @@ class ThetaOptionUpdateControl(private val sessionIdProvider: IThetaSessionIdPro
                     }
                     else
                     {
-                        Log.v(TAG, "setOptions() reply is null or empty.")
+                        Log.v(TAG, "setOptions() reply is null or empty.  $postData")
                         callBack?.operationExecuted(-1, "")
                     }
                 }
index c4dd47f..d6e29ca 100644 (file)
@@ -6,11 +6,6 @@ import java.util.List;
 
 public interface ICameraStatus
 {
-    @NonNull List<String> getStatusList(final @NonNull String key);
-    @NonNull String getStatus(final @NonNull String key);
-    //void setStatus(final @NonNull String key, final @NonNull String value);
-
-
     String THETA_BATTERY_LEVEL = "batteryLevel";
     String THETA_CAPTURE_STATUS = "_captureStatus";
     String THETA_RECORDING_SEC = "_recordedTime";
@@ -26,37 +21,6 @@ public interface ICameraStatus
     String THETA_ISO_SENSITIVITY = "iso";
     String THETA_SHUTTER_SPEED = "shutterSpeed";
     String THETA_WHITE_BALANCE = "whiteBalance";
+    String THETA_FILTER = "_filter";
 
-    /*
-    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";
- */
 }
index 5393e09..8c99d7a 100644 (file)
@@ -1,42 +1,34 @@
 package jp.sfjp.gokigen.a01c.thetacamerawrapper.status
 
+import android.graphics.Color
 import android.util.Log
-import jp.sfjp.gokigen.a01c.ICameraStatusUpdateNotify
 import jp.sfjp.gokigen.a01c.ICameraStatusWatcher
-import jp.sfjp.gokigen.a01c.thetacamerawrapper.IThetaStatusHolder
+import jp.sfjp.gokigen.a01c.IShowInformation
 import jp.sfjp.gokigen.a01c.thetacamerawrapper.IThetaSessionIdProvider
+import jp.sfjp.gokigen.a01c.thetacamerawrapper.IThetaStatusHolder
 import jp.sfjp.gokigen.a01c.thetacamerawrapper.status.ICameraStatus.*
 import jp.sfjp.gokigen.a01c.utils.SimpleHttpClient
 import org.json.JSONObject
 
-class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdProvider, private val statusHolder : IThetaStatusHolder) : ICameraStatus, ICameraStatusWatcher
+class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdProvider, private val statusHolder: IThetaStatusHolder, private val showInformation: IShowInformation) : ICameraStatusWatcher
 {
     private val httpClient = SimpleHttpClient()
     private var whileFetching = false
     private var currentBatteryLevel : Double = 0.0
     private var currentExposureCompensation : Double = 0.0
     private var currentCaptureMode : String = ""
+    private var currentExposureProgram : String = ""
     private var currentCaptureStatus : String = ""
     private var currentBatteryStatus : String = ""
     private var currentWhiteBalance : String = ""
+    private var currentFilter : String = ""
 
-
-    override fun getStatusList(key: String): List<String>
+    override fun startStatusWatch()
     {
-        return (ArrayList())
+        startStatusWatch1()
     }
 
-    override fun getStatus(key: String): String
-    {
-        return ("")
-    }
-
-    override fun startStatusWatch(notifier: ICameraStatusUpdateNotify)
-    {
-        startStatusWatch1(notifier)
-    }
-
-    private fun startStatusWatch1(notifier: ICameraStatusUpdateNotify)
+    private fun startStatusWatch1()
     {
         if (whileFetching)
         {
@@ -50,7 +42,7 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                 try
                 {
                     val getOptionsUrl = "http://192.168.1.1/osc/commands/execute"
-                    val postData = if (sessionIdProvider.sessionId.isEmpty()) "{\"name\":\"camera.getOptions\",\"parameters\":{\"timeout\":0, \"optionNames\" : [ \"aperture\",\"captureMode\",\"exposureCompensation\",\"exposureProgram\",\"iso\",\"shutterSpeed\",\"whiteBalance\"] }" else "{\"name\":\"camera.getOptions\",\"parameters\":{\"sessionId\": \"" + sessionIdProvider.sessionId + "\", \"optionNames\" : [ \"aperture\",\"captureMode\",\"exposureCompensation\",\"exposureProgram\",\"iso\",\"shutterSpeed\",\"whiteBalance\"] }}"
+                    val postData = if (sessionIdProvider.sessionId.isEmpty()) "{\"name\":\"camera.getOptions\",\"parameters\":{\"timeout\":0, \"optionNames\" : [ \"aperture\",\"captureMode\",\"exposureCompensation\",\"exposureProgram\",\"iso\",\"shutterSpeed\",\"_filter\",\"whiteBalance\"] }" else "{\"name\":\"camera.getOptions\",\"parameters\":{\"sessionId\": \"" + sessionIdProvider.sessionId + "\", \"optionNames\" : [ \"aperture\",\"captureMode\",\"exposureCompensation\",\"exposureProgram\",\"iso\",\"shutterSpeed\",\"_filter\",\"whiteBalance\"] }}"
 
                     Log.v(TAG, " >>>>> START STATUS WATCH : $getOptionsUrl $postData")
                     while (whileFetching)
@@ -59,7 +51,7 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                         if (!(response.isNullOrEmpty()))
                         {
                             // ステータスデータ受信
-                            checkStatus1(response, notifier)
+                            checkStatus1(response)
                         }
                         try
                         {
@@ -84,7 +76,7 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
         }
     }
 
-    private fun checkStatus1(response : String, notifier: ICameraStatusUpdateNotify)
+    private fun checkStatus1(response: String)
     {
         try
         {
@@ -97,10 +89,18 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                 {
                     Log.v(TAG, " EXPREV : $currentExposureCompensation => $exposureCompensation")
                     currentExposureCompensation = exposureCompensation
-                    notifier.updatedExposureCompensation(String.format("%1.1f",currentExposureCompensation))
+                    if (currentExposureCompensation == 0.0)
+                    {
+                        // 補正なしの時には数値を表示しない
+                        showInformation.setMessage(IShowInformation.AREA_6, Color.WHITE, "")
+                    }
+                    else
+                    {
+                        showInformation.setMessage(IShowInformation.AREA_6, Color.WHITE, String.format("%1.1f", currentExposureCompensation))
+                    }
                 }
             }
-            catch (e : Exception)
+            catch (e: Exception)
             {
                 e.printStackTrace()
             }
@@ -112,9 +112,17 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                 {
                     Log.v(TAG, " WB : $currentWhiteBalance => $whiteBalance")
                     currentWhiteBalance = whiteBalance
+                    if (currentWhiteBalance == "auto")
+                    {
+                        showInformation.setMessage(IShowInformation.AREA_7, Color.WHITE, "")
+                    }
+                    else
+                    {
+                        showInformation.setMessage(IShowInformation.AREA_7, Color.WHITE, currentWhiteBalance)
+                    }
                 }
             }
-            catch (e : Exception)
+            catch (e: Exception)
             {
                 e.printStackTrace()
             }
@@ -125,24 +133,61 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                 if (captureMode != currentCaptureMode)
                 {
                     Log.v(TAG, " CAPTURE MODE : $currentCaptureMode -> $captureMode")
-                    notifier.updateCaptureMode(captureMode)
                     currentCaptureMode = captureMode
-                    statusHolder.setCaptureMode(captureMode)
+                    statusHolder.captureMode = captureMode
+                    showInformation.setMessage(IShowInformation.AREA_1, Color.WHITE, captureMode)
+                }
+            }
+            catch (e: Exception)
+            {
+                e.printStackTrace()
+            }
+
+            try
+            {
+                val exposureProgram = stateObject.getString(THETA_EXPOSURE_PROGRAM)
+                if (exposureProgram != currentExposureProgram)
+                {
+                    Log.v(TAG, " EXPOSURE PROGRAM : $currentExposureProgram -> $exposureProgram")
+                    currentExposureProgram = exposureProgram
+                    //showInformation.setMessage(IShowInformation.AREA_8, Color.WHITE, currentExposureProgram)
                 }
             }
-            catch (e : Exception)
+            catch (e: Exception)
+            {
+                e.printStackTrace()
+            }
+
+            try
+            {
+                val filterValue = stateObject.getString(THETA_FILTER)
+                if (filterValue != currentFilter)
+                {
+                    Log.v(TAG, " FILTER : $currentFilter -> $filterValue")
+                    currentFilter = filterValue
+                    if (currentFilter == "off")
+                    {
+                        showInformation.setMessage(IShowInformation.AREA_5, Color.WHITE, "")
+                    }
+                    else
+                    {
+                        showInformation.setMessage(IShowInformation.AREA_5, Color.WHITE, currentFilter)
+                    }
+                }
+            }
+            catch (e: Exception)
             {
                 e.printStackTrace()
             }
         }
-        catch (ee : Exception)
+        catch (ee: Exception)
         {
             ee.printStackTrace()
         }
     }
 
 
-    private fun startStatusWatch0(notifier: ICameraStatusUpdateNotify)
+    private fun startStatusWatch0()
     {
         if (whileFetching)
         {
@@ -163,7 +208,7 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                         if (!(response.isNullOrEmpty()))
                         {
                             // ステータスデータ受信
-                            checkStatus0(response, notifier)
+                            checkStatus0(response)
                         }
                         try
                         {
@@ -188,7 +233,7 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
         }
     }
 
-    private fun checkStatus0(response : String, notifier: ICameraStatusUpdateNotify)
+    private fun checkStatus0(response: String)
     {
         try
         {
@@ -201,10 +246,10 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                 {
                     Log.v(TAG, " BATTERY : $currentBatteryLevel => $batteryLevel")
                     currentBatteryLevel = batteryLevel
-                    notifier.updateRemainBattery(currentBatteryLevel)
+                    updateRemainBattery(currentBatteryLevel)
                 }
             }
-            catch (e : Exception)
+            catch (e: Exception)
             {
                 e.printStackTrace()
             }
@@ -218,7 +263,7 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                     currentBatteryStatus = batteryStatus
                 }
             }
-            catch (e : Exception)
+            catch (e: Exception)
             {
                 e.printStackTrace()
             }
@@ -231,36 +276,52 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
                     Log.v(TAG, " CAPTURE STATUS : $currentCaptureStatus -> $captureStatus")
                     if (captureStatus != "idle")
                     {
-                        notifier.updateCameraStatus(captureStatus)
+                        showInformation.setMessage(IShowInformation.AREA_5, Color.WHITE, captureStatus)
                     }
                     currentCaptureStatus = captureStatus
                 }
             }
-            catch (e : Exception)
+            catch (e: Exception)
             {
                 e.printStackTrace()
             }
         }
-        catch (ee : Exception)
+        catch (ee: Exception)
         {
             ee.printStackTrace()
         }
     }
 
-    override fun stopStatusWatch()
+    private fun updateRemainBattery(percentageDouble: Double)
     {
-        whileFetching = false
+        var color = Color.YELLOW
+        if (percentageDouble < 0.5)
+        {
+            if (percentageDouble < 0.3)
+            {
+                color = Color.RED
+            }
+            try
+            {
+                val percentage = Math.ceil(percentageDouble * 100.0).toInt()
+                showInformation.setMessage(IShowInformation.AREA_7, color, "Bat: $percentage%")
+            }
+            catch (ee: java.lang.Exception)
+            {
+                ee.printStackTrace()
+            }
+        }
     }
 
-    override fun prepareStatusWatch()
+    override fun stopStatusWatch()
     {
-        //
+        whileFetching = false
     }
 
     companion object
     {
         private val TAG = ThetaCameraStatusWatcher::class.java.simpleName
         private const val timeoutMs = 1500
-        private const val loopWaitMs : Long = 660
+        private const val loopWaitMs : Long = 350
     }
 }
index c946e66..2df0607 100644 (file)
     </string-array>
 
     <string-array name="exposure_compensation_value">
-        <item>"exposureCompensation" : -2.0</item>
-        <item>"exposureCompensation" : -1.7</item>
-        <item>"exposureCompensation" : -1.3</item>
-        <item>"exposureCompensation" : -1.0</item>
-        <item>"exposureCompensation" : -0.7</item>
-        <item>"exposureCompensation" : -0.3</item>
-        <item>"exposureCompensation" : 0.0</item>
-        <item>"exposureCompensation" : 0.3</item>
-        <item>"exposureCompensation" : 0.7</item>
-        <item>"exposureCompensation" : 1.0</item>
-        <item>"exposureCompensation" : 1.3</item>
-        <item>"exposureCompensation" : 1.7</item>
-        <item>"exposureCompensation" : 2.0</item>
+        <item>\"exposureCompensation\" : -2.0</item>
+        <item>\"exposureCompensation\" : -1.7</item>
+        <item>\"exposureCompensation\" : -1.3</item>
+        <item>\"exposureCompensation\" : -1.0</item>
+        <item>\"exposureCompensation\" : -0.7</item>
+        <item>\"exposureCompensation\" : -0.3</item>
+        <item>\"exposureCompensation\" : 0.0</item>
+        <item>\"exposureCompensation\" : 0.3</item>
+        <item>\"exposureCompensation\" : 0.7</item>
+        <item>\"exposureCompensation\" : 1.0</item>
+        <item>\"exposureCompensation\" : 1.3</item>
+        <item>\"exposureCompensation\" : 1.7</item>
+        <item>\"exposureCompensation\" : 2.0</item>
+    </string-array>
+
+    <string-array name="exposure_program">
+        <item>M</item>
+        <item>P</item>
+        <item>S</item>
+        <item>I</item>
+        <item>A</item>
+    </string-array>
+
+    <string-array name="exposure_program_value">
+        <item>\"exposureProgram\" : 1 </item>
+        <item>\"exposureProgram\" : 2 </item>
+        <item>\"exposureProgram\" : 4 </item>
+        <item>\"exposureProgram\" : 9 </item>
+        <item>\"exposureProgram\" : 3 </item>
+    </string-array>
+
+    <string-array name="theta_filter_set">
+        <item>off</item>
+        <item>DRc</item>
+        <item>NR</item>
+        <item>HDR</item>
+        <item>Hh hdr</item>
+    </string-array>
+
+    <string-array name="theta_filter_set_value">
+        <item>\"_filter\" : \"off\"</item>
+        <item>\"_filter\" : \"DR Comp\"</item>
+        <item>\"_filter\" : \"Noise Reduction\"</item>
+        <item>\"_filter\" : \"hdr\"</item>
+        <item>\"_filter\" : \"Hh hdr\"</item>
+    </string-array>
+
+    <string-array name="white_balance_value">
+        <item>\"whiteBalance\" : \"auto\"</item>
+        <item>\"whiteBalance\" : \"daylight\" </item>
+        <item>\"whiteBalance\" : \"shade\" </item>
+        <item>\"whiteBalance\" : \"cloudy-daylight\" </item>
+        <item>\"whiteBalance\" : \"incandescent\" </item>
+        <item>\"whiteBalance\" : \"_warmWhiteFluorescent\"</item>
+        <item>\"whiteBalance\" : \"_dayLightFluorescent\" </item>
+        <item>\"whiteBalance\" : \"_dayWhiteFluorescent\" </item>
+        <item>\"whiteBalance\" : \"fluorescent\" </item>
+        <item>\"whiteBalance\" : \"_bulbFluorescent\" </item>
+        <item>\"whiteBalance\" : \"_colorTemperature\" </item>
+        <item>\"whiteBalance\" : \"_underwater\" </item>
     </string-array>
 
 </resources>
\ No newline at end of file