OSDN Git Service

シャッタースピードの変更に対応。(WPZ用)
authorMRSa <mrsa@myad.jp>
Wed, 8 Sep 2021 15:09:10 +0000 (00:09 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 8 Sep 2021 15:09:10 +0000 (00:09 +0900)
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/pixpro/wrapper/status/PixproStatusChecker.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/pixpro/wrapper/status/PixproStatusConvert.kt
app/src/main/java/jp/osdn/gokigen/gokigenassets/camera/vendor/pixpro/wrapper/status/PixproStatusHolder.kt

index d631b43..22eb21c 100644 (file)
@@ -7,8 +7,6 @@ import jp.osdn.gokigen.gokigenassets.camera.interfaces.ICameraStatus
 import jp.osdn.gokigen.gokigenassets.camera.interfaces.ICameraStatusWatcher
 import jp.osdn.gokigen.gokigenassets.camera.vendor.pixpro.wrapper.command.IPixproCommandPublisher
 import jp.osdn.gokigen.gokigenassets.camera.vendor.pixpro.wrapper.command.messages.IPixproCommandCallback
-import jp.osdn.gokigen.gokigenassets.camera.vendor.pixpro.wrapper.command.messages.base.PixproCommandOnlyCallback
-import jp.osdn.gokigen.gokigenassets.camera.vendor.pixpro.wrapper.command.messages.specific.PixproChangeExposureCompensation
 import jp.osdn.gokigen.gokigenassets.camera.vendor.pixpro.wrapper.command.messages.specific.PixproStatusRequest
 import jp.osdn.gokigen.gokigenassets.liveview.message.IMessageDrawer
 import jp.osdn.gokigen.gokigenassets.utils.communication.SimpleLogDumper
@@ -24,7 +22,8 @@ class PixproStatusChecker : IPixproCommandCallback, ICameraStatusWatcher, ICamer
     companion object
     {
         private val TAG = PixproStatusChecker::class.java.simpleName
-        private const val EVENT_POLL_QUEUE_MS = 1000
+        private const val EVENT_POLL_QUEUE_MS = 350
+        private const val isDumpLog = false
     }
 
     fun setCommandPublisher(commandPublisher : IPixproCommandPublisher)
@@ -104,7 +103,7 @@ class PixproStatusChecker : IPixproCommandCallback, ICameraStatusWatcher, ICamer
                     {
                         Thread.sleep(EVENT_POLL_QUEUE_MS.toLong())
 
-                        Log.v(TAG, "  ----- POLL EVENT -----  ")
+                        Log.v(TAG, " === POLL EVENT === ")
                         if (::commandPublisher.isInitialized)
                         {
                             commandPublisher.enqueueCommand(PixproStatusRequest(this))
@@ -140,8 +139,11 @@ class PixproStatusChecker : IPixproCommandCallback, ICameraStatusWatcher, ICamer
 
     override fun receivedMessage(id: Int, rx_body: ByteArray?)
     {
-        Log.v(TAG, " RECEIVED EVENT : ${rx_body?.size} bytes.")
-        SimpleLogDumper.dumpBytes("EVT[${rx_body?.size}]", rx_body)
+        if (isDumpLog)
+        {
+            Log.v(TAG, " RECEIVED EVENT : ${rx_body?.size} bytes.")
+            SimpleLogDumper.dumpBytes("EVT[${rx_body?.size}]", rx_body)
+        }
         try
         {
             val length = rx_body?.size ?: 0
@@ -222,6 +224,64 @@ class PixproStatusChecker : IPixproCommandCallback, ICameraStatusWatcher, ICamer
                     else -> "($exprev0)"
                 }
                 statusHolder.updateValue(ICameraStatus.EXPREV, exposureCompensation)
+
+
+                // Shutter Speed
+                val shutterSpeed = when (val sv = rx_body?.get(16 * 75 + 8))
+                {
+                    0x01.toByte() -> "1/2000"
+                    0x02.toByte() -> "1/1600"
+                    0x03.toByte() -> "1/1200"
+                    0x04.toByte() -> "1/1000"
+                    0x05.toByte() -> "1/800"
+                    0x06.toByte() -> "1/600"
+                    0x07.toByte() -> "1/500"
+                    0x08.toByte() -> "1/400"
+                    0x09.toByte() -> "1/320"
+                    0x0a.toByte() -> "1/250"
+                    0x0b.toByte() -> "1/200"
+                    0x0c.toByte() -> "1/160"
+                    0x0d.toByte() -> "1/125"
+                    0x0e.toByte() -> "1/100"
+                    0x0f.toByte() -> "1/80"
+                    0x10.toByte() -> "1/60"
+                    0x11.toByte() -> "1/50"
+                    0x12.toByte() -> "1/40"
+                    0x13.toByte() -> "1/30"
+                    0x14.toByte() -> "1/25"
+                    0x15.toByte() -> "1/20"
+                    0x16.toByte() -> "1/15"
+                    0x17.toByte() -> "1/13"
+                    0x18.toByte() -> "1/10"
+                    0x19.toByte() -> "1/8"
+                    0x1a.toByte() -> "1/6"
+                    0x1b.toByte() -> "1/5"
+                    0x1c.toByte() -> "1/4"
+                    0x1d.toByte() -> "1/3"
+                    0x1e.toByte() -> "1/2.5"
+                    0x1f.toByte() -> "1/2"
+                    0x20.toByte() -> "1/1.6"
+                    0x21.toByte() -> "1/1.3"
+                    0x22.toByte() -> "1s"
+                    0x23.toByte() -> "1.3s"
+                    0x24.toByte() -> "1.5s"
+                    0x25.toByte() -> "2s"
+                    0x26.toByte() -> "2.5s"
+                    0x27.toByte() -> "3s"
+                    0x28.toByte() -> "4s"
+                    0x29.toByte() -> "5s"
+                    0x2a.toByte() -> "6s"
+                    0x2b.toByte() -> "8s"
+                    0x2c.toByte() -> "10s"
+                    0x2d.toByte() -> "13s"
+                    0x2e.toByte() -> "15s"
+                    0x2f.toByte() -> "20s"
+                    0x30.toByte() -> "25s"
+                    0x31.toByte() -> "30s"
+
+                    else -> "($sv)"
+                }
+                statusHolder.updateValue(ICameraStatus.SHUTTER_SPEED, shutterSpeed)
             }
         }
         catch (e: Exception)
index 608d642..73ee8e6 100644 (file)
@@ -40,40 +40,40 @@ class PixproStatusConvert(private val statusHolder: PixproStatusHolder)
             "1/125",
             "1/100",
             "1/80",
-            "0x10",
-            "0x11",
-            "0x12",
-            "0x13",
-            "0x14",
-            "0x15",
-            "0x16",
-            "0x17",
-            "0x18",
-            "0x19",
-            "0x1a",
-            "0x1b",
-            "0x1c",
-            "0x1d",
-            "0x1e",
-            "0x1f",
-            "0x20",
-            "0x21",
-            "0x22",
-            "0x23",
-            "0x24",
-            "0x25",
-            "0x26",
-            "0x27",
-            "0x28",
-            "0x29",
-            "0x2a",
-            "0x2b",
-            "0x2c",
-            "0x2d",
-            "0x2e",
-            "0x2f",
-            "0x30",
-            "0x31",
+            "1/60",
+            "1/50",
+            "1/40",
+            "1/30",
+            "1/25",
+            "1/20",
+            "1/15",
+            "1/13",
+            "1/10",
+            "1/8",
+            "1/6",
+            "1/5",
+            "1/4",
+            "1/3",
+            "1/2.5",
+            "1/2",
+            "1/1.6",
+            "1/1.3",
+            "1s",
+            "1.3s",
+            "1.5s",
+            "2s",
+            "2.5s",
+            "3s",
+            "4s",
+            "5s",
+            "6s",
+            "8s",
+            "10s",
+            "13s",
+            "15s",
+            "20s",
+            "25s",
+            "30s",
         ))
     }
 
index 709b535..650e60d 100644 (file)
@@ -234,40 +234,40 @@ class PixproStatusHolder
                 "1/125" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x0d))
                 "1/100" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x0e))
                 "1/80" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x0f))
-                "0x10" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x10))
-                "0x11" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x11))
-                "0x12" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x12))
-                "0x13" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x13))
-                "0x14" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x14))
-                "0x15" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x15))
-                "0x16" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x16))
-                "0x17" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x17))
-                "0x18" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x18))
-                "0x19" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x19))
-                "0x1a" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1a))
-                "0x1b" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1b))
-                "0x1c" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1c))
-                "0x1d" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1d))
-                "0x1e" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1e))
-                "0x1f" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1f))
-                "0x20" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x20))
-                "0x21" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x21))
-                "0x22" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x22))
-                "0x23" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x23))
-                "0x24" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x24))
-                "0x25" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x25))
-                "0x26" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x26))
-                "0x27" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x27))
-                "0x28" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x28))
-                "0x29" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x29))
-                "0x2a" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2a))
-                "0x2b" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2b))
-                "0x2c" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2c))
-                "0x2d" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2d))
-                "0x2e" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2e))
-                "0x2f" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2f))
-                "0x30" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x30))
-                "0x31" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x31))
+                "1/60" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x10))
+                "1/50" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x11))
+                "1/40" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x12))
+                "1/30" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x13))
+                "1/25" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x14))
+                "1/20" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x15))
+                "1/15" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x16))
+                "1/13" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x17))
+                "1/10" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x18))
+                "1/8" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x19))
+                "1/6" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1a))
+                "1/5" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1b))
+                "1/4" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1c))
+                "1/3" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1d))
+                "1/2.5" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1e))
+                "1/2" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x1f))
+                "1/1.6" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x20))
+                "1/1.3" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x21))
+                "1s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x22))
+                "1.3s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x23))
+                "1.5s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x24))
+                "2s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x25))
+                "2.5s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x26))
+                "3s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x27))
+                "4s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x28))
+                "5s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x29))
+                "6s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2a))
+                "8s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2b))
+                "10s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2c))
+                "13s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2d))
+                "15s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2e))
+                "20s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x2f))
+                "25s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x30))
+                "30s" -> commandPublisher.enqueueCommand(PixproChangeShutterSpeed(PixproCommandOnlyCallback(), 0x31))
                 else -> { }
             }
         }