OSDN Git Service

EEG接続と数値の表示まで。
authorMRSa <mrsa@myad.jp>
Tue, 2 Mar 2021 15:02:42 +0000 (00:02 +0900)
committerMRSa <mrsa@myad.jp>
Tue, 2 Mar 2021 15:02:42 +0000 (00:02 +0900)
app/src/main/AndroidManifest.xml
app/src/main/java/jp/osdn/gokigen/thetaview/bluetooth/connection/BluetoothDeviceFinder.kt
app/src/main/java/jp/osdn/gokigen/thetaview/camera/theta/status/ThetaCameraStatusWatcher.kt
app/src/main/java/jp/osdn/gokigen/thetaview/liveview/GokigenGLView.kt
app/src/main/java/jp/osdn/gokigen/thetaview/scene/EEGShutter.kt

index dee630c..1556d94 100644 (file)
@@ -22,6 +22,7 @@
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
         android:roundIcon="@mipmap/ic_launcher_round"
+        android:usesCleartextTraffic="true"
         android:supportsRtl="true"
         android:theme="@style/Theme.ThetaView">
         <activity android:name=".MainActivity">
@@ -31,6 +32,7 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
+        <meta-data android:name="android.max_aspect" android:value="ratio_float"/>
     </application>
 
 </manifest>
\ No newline at end of file
index 34dd7d8..e11695c 100644 (file)
@@ -16,9 +16,10 @@ class BluetoothDeviceFinder(private val context: AppCompatActivity, private val
     {
         private val TAG = BluetoothDeviceFinder::class.java.simpleName
     }
+
     private lateinit var targetDeviceName: String
     private var foundBleDevice = false
-    private var scanner : BluetoothLeScanner? = null
+    private var scanner: BluetoothLeScanner? = null
 
     override fun reset()
     {
@@ -35,7 +36,7 @@ class BluetoothDeviceFinder(private val context: AppCompatActivity, private val
             scanner?.flushPendingScanResults(this)
             scanner?.stopScan(this)
         }
-        catch (e : Exception)
+        catch (e: Exception)
         {
             e.printStackTrace()
         }
@@ -120,7 +121,7 @@ class BluetoothDeviceFinder(private val context: AppCompatActivity, private val
         val device = result?.device
         Log.v(TAG, " onScanResult($callbackType, ${device?.name}) ")
         val findDevice = (device?.name)?.contains(targetDeviceName)
-        if ((findDevice != null)&&(findDevice))
+        if ((findDevice != null) && (findDevice))
         {
             Log.v(TAG, " FIND DEVICE : $targetDeviceName")
             scanResult.foundBluetoothDevice(device)
index c913d46..96577d4 100644 (file)
@@ -46,6 +46,15 @@ class ThetaCameraStatusWatcher(private val sessionIdProvider: IThetaSessionIdPro
             setMessage(IIndicator.Area.AREA_9, Color.WHITE, "")
             setMessage(IIndicator.Area.AREA_10, Color.WHITE, "")
             setMessage(IIndicator.Area.AREA_11, Color.WHITE, "")
+
+            setMessage(IIndicator.Area.AREA_A, Color.WHITE, "")
+            setMessage(IIndicator.Area.AREA_B, Color.WHITE, "")
+            setMessage(IIndicator.Area.AREA_C, Color.WHITE, "")
+            setMessage(IIndicator.Area.AREA_D, Color.WHITE, "")
+            setMessage(IIndicator.Area.AREA_E, Color.WHITE, "")
+            setMessage(IIndicator.Area.AREA_F, Color.WHITE, "")
+            setMessage(IIndicator.Area.AREA_G, Color.WHITE, "")
+            setMessage(IIndicator.Area.AREA_H, Color.WHITE, "")
         }
         catch (e : Exception)
         {
index f1601f2..5fa021b 100644 (file)
@@ -3,6 +3,7 @@ package jp.osdn.gokigen.thetaview.liveview
 import android.content.Context
 import android.graphics.PixelFormat
 import android.opengl.GLSurfaceView
+import android.os.Looper
 import android.util.AttributeSet
 import android.util.Log
 import jp.osdn.gokigen.thetaview.liveview.glrenderer.EquirectangularDrawer
@@ -98,7 +99,14 @@ class GokigenGLView : GLSurfaceView, ILiveViewRefresher, ILiveView, IMessageDraw
 
     override fun refresh()
     {
-        invalidate()
+        if (Looper.getMainLooper().thread === Thread.currentThread())
+        {
+            invalidate()
+        }
+        else
+        {
+            postInvalidate()
+        }
     }
 
     override fun setImageProvider(provider: IImageProvider)
index 36c10c5..dba290e 100644 (file)
@@ -137,7 +137,7 @@ class EEGShutter(activity : AppCompatActivity, private val bluetoothStatusNotify
                     attention > 30 -> { Color.LTGRAY }
                     else -> { Color.DKGRAY }
                 }
-                indicator.setMessage(IIndicator.Area.AREA_G, colorAttention, "ATTENTION : $attention")
+                indicator.setMessage(IIndicator.Area.AREA_A, colorAttention, "ATTENTION : $attention")
 
                 val colorMediation = when {
                     mediation > 90 -> { Color.GREEN }
@@ -146,7 +146,7 @@ class EEGShutter(activity : AppCompatActivity, private val bluetoothStatusNotify
                     mediation > 30 -> { Color.LTGRAY }
                     else -> { Color.DKGRAY }
                 }
-                indicator.setMessage(IIndicator.Area.AREA_G, colorMediation, "MEDIATION : $mediation")
+                indicator.setMessage(IIndicator.Area.AREA_B, colorMediation, "MEDIATION : $mediation")
                 indicator.invalidate()
             }
         }