1 package jp.sfjp.gokigen.a01c
3 import android.Manifest
4 import android.content.ActivityNotFoundException
5 import android.content.Intent
6 import android.content.pm.PackageManager
7 import android.graphics.Color
9 import android.provider.Settings
10 import android.util.Log
11 import android.view.MotionEvent
12 import android.view.View
13 import android.view.ViewConfiguration
14 import android.view.WindowManager
15 import android.widget.ImageButton
16 import android.widget.TextView
17 import android.widget.Toast
18 import androidx.appcompat.app.AppCompatActivity
19 import androidx.core.app.ActivityCompat
20 import androidx.core.content.ContextCompat
21 import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
22 import androidx.core.view.InputDeviceCompat
23 import androidx.core.view.MotionEventCompat
24 import androidx.core.view.ViewConfigurationCompat
25 import androidx.core.widget.NestedScrollView
26 import androidx.preference.PreferenceManager
27 import jp.sfjp.gokigen.a01c.IShowInformation.operation
28 import jp.sfjp.gokigen.a01c.liveview.*
29 import jp.sfjp.gokigen.a01c.liveview.dialog.FavoriteSettingSelectionDialog
30 import jp.sfjp.gokigen.a01c.liveview.dialog.IDialogDismissedNotifier
31 import jp.sfjp.gokigen.a01c.liveview.glview.GokigenGLView
32 import jp.sfjp.gokigen.a01c.olycamerawrapper.OlyCameraCoordinator
33 import jp.sfjp.gokigen.a01c.preference.IPreferenceCameraPropertyAccessor
34 import jp.sfjp.gokigen.a01c.preference.PreferenceAccessWrapper
35 import jp.sfjp.gokigen.a01c.thetacamerawrapper.ThetaCameraController
36 import jp.sfjp.gokigen.a01c.utils.GestureParser
37 import kotlin.math.roundToInt
43 class MainActivity : AppCompatActivity(), IChangeScene, IShowInformation, ICameraStatusReceiver, IDialogDismissedNotifier, IWifiConnection
45 private lateinit var preferences: PreferenceAccessWrapper
46 private var liveView: CameraLiveImageView? = null
47 private var glView: GokigenGLView? = null
48 private var powerManager: PowerManager? = null
49 private var gestureParser: GestureParser? = null
50 private var currentCoordinator: ICameraController? = null
51 private var olyAirCoordinator: ICameraController? = null
52 private var thetaCoordinator: ICameraController? = null
53 private var messageDrawer: IMessageDrawer? = null
54 private var listener: CameraLiveViewOnTouchListener? = null
55 private var selectionDialog: FavoriteSettingSelectionDialog? = null
56 private var cameraDisconnectedHappened = false
57 private var wifiConnection: WifiConnection? = null
58 private var liveViewListener: CameraLiveViewListenerImpl? = null
59 private var enableGlView = false
64 override fun onCreate(savedInstanceState: Bundle?)
66 Log.v(TAG, "onCreate()")
67 super.onCreate(savedInstanceState)
70 ///////// SHOW SPLASH SCREEN /////////
79 setContentView(R.layout.activity_main)
80 supportActionBar?.hide()
81 window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
87 // GPS機能が搭載されていない場合...ログに出力する
88 Log.d(TAG, " ----- This hardware doesn't have GPS.")
91 powerManager = getSystemService(POWER_SERVICE) as PowerManager
93 setupCameraCoordinator()
94 setupInitialButtonIcons()
104 if (allPermissionsGranted())
106 wifiConnection = WifiConnection(this, this)
107 wifiConnection?.requestNetwork()
111 Log.v(TAG, ">>> Request Permissions...")
112 ActivityCompat.requestPermissions(this, REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS)
115 catch (ex: Exception)
121 private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all {
122 ContextCompat.checkSelfPermission(baseContext, it) == PackageManager.PERMISSION_GRANTED
128 override fun onResume()
131 Log.v(TAG, "onResume()")
134 if (wifiConnection != null)
137 wifiConnection?.requestNetwork()
138 wifiConnection?.startWatchWifiStatus()
150 override fun onPause()
153 Log.v(TAG, "onPause()")
160 public override fun onStart()
163 Log.v(TAG, "onStart()")
170 public override fun onStop()
173 Log.v(TAG, "onStop()")
178 * ボタンが押された、画面がタッチされた、、は、リスナクラスで処理するよう紐づける
181 private fun setupActionListener()
185 Log.v(TAG, "setupActionListener()")
186 val btn1 = findViewById<ImageButton>(R.id.btn_1)
187 btn1.setOnClickListener(listener)
188 btn1.setOnLongClickListener(listener)
189 val btn2 = findViewById<ImageButton>(R.id.btn_2)
190 btn2.setOnClickListener(listener)
191 btn2.setOnLongClickListener(listener)
192 val btn3 = findViewById<ImageButton>(R.id.btn_3)
193 btn3.setOnClickListener(listener)
194 btn3.setOnLongClickListener(listener)
195 val btn4 = findViewById<ImageButton>(R.id.btn_4)
196 btn4.setOnClickListener(listener)
197 btn4.setOnLongClickListener(listener)
198 val btn5 = findViewById<ImageButton>(R.id.btn_5)
199 btn5.setOnClickListener(listener)
200 btn5.setOnLongClickListener(listener)
201 val btn6 = findViewById<ImageButton>(R.id.btn_6)
202 btn6.setOnClickListener(listener)
203 btn6.setOnLongClickListener(listener)
204 val textArea1 = findViewById<ImageButton>(R.id.btn_021)
205 textArea1.setOnClickListener(listener)
206 textArea1.setOnLongClickListener(listener)
207 val textArea2 = findViewById<ImageButton>(R.id.btn_022)
208 textArea2.setOnClickListener(listener)
209 textArea2.setOnLongClickListener(listener)
210 val textArea3 = findViewById<ImageButton>(R.id.btn_023)
211 textArea3.setOnClickListener(listener)
212 textArea3.setOnLongClickListener(listener)
213 val textArea4 = findViewById<ImageButton>(R.id.btn_024)
214 textArea4.setOnClickListener(listener)
215 textArea4.setOnLongClickListener(listener)
216 if (liveView == null)
218 liveView = findViewById(R.id.liveview)
220 liveView?.setOnTouchListener(listener)
221 messageDrawer = liveView?.messageDrawer
222 messageDrawer?.setLevelGauge(currentCoordinator?.levelGauge)
236 private fun setupInitialButtonIcons()
240 if (currentCoordinator != null)
243 val preferences = PreferenceManager.getDefaultSharedPreferences(this)
244 resId = if (preferences.getBoolean(
245 IPreferenceCameraPropertyAccessor.SHOW_GRID_STATUS,
249 // ボタンをGrid OFFアイコンにする
250 R.drawable.btn_ic_grid_off
252 // ボタンをGrid ONアイコンにする
253 R.drawable.btn_ic_grid_on
255 setButtonDrawable(IShowInformation.BUTTON_1, resId)
264 override fun onGenericMotionEvent(ev: MotionEvent?): Boolean
268 if ((ev?.action == MotionEvent.ACTION_SCROLL)&& (ev.isFromSource(InputDeviceCompat.SOURCE_ROTARY_ENCODER)))
271 // Log.v(TAG, "Rotary Encoder Input")
272 val view = findViewById<NestedScrollView>(R.id.main_screen)
273 val delta = -ev.getAxisValue(MotionEventCompat.AXIS_SCROLL) *
274 ViewConfigurationCompat.getScaledVerticalScrollFactor(ViewConfiguration.get(this), this)
275 view.scrollBy(0, delta.roundToInt())
283 return (super.onGenericMotionEvent(ev))
287 * Intentを使ってWiFi設定画面を開く
290 private fun launchWifiSettingScreen(): Boolean
292 Log.v(TAG, "launchWifiSettingScreen() : ACTION_WIFI_SETTINGS")
296 startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
300 catch (ex: Exception)
304 Log.v(TAG, "launchWifiSettingScreen() : ADD_NETWORK_SETTINGS")
305 startActivity(Intent("com.google.android.clockwork.settings.connectivity.wifi.ADD_NETWORK_SETTINGS"))
312 "android.content.ActivityNotFoundException... " + "com.google.android.clockwork.settings.connectivity.wifi.ADD_NETWORK_SETTINGS"
315 // SONY Smart Watch 3で開く場合のIntent...
317 Intent("com.google.android.clockwork.settings.connectivity.wifi.ADD_NETWORK_SETTINGS")
319 "com.google.android.apps.wearable.settings",
320 "com.google.android.clockwork.settings.wifi.WifiSettingsActivity"
322 startActivity(intent)
324 } catch (ex2: Exception) {
326 // Wifi 設定画面を表示する...普通のAndroidの場合
327 startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
329 } catch (ee: Exception) {
332 // LG G Watch Rで開く場合のIntent...
333 val intent = Intent("android.intent.action.MAIN")
335 "com.google.android.apps.wearable.settings",
336 "com.google.android.clockwork.settings.MainSettingsActivity"
338 startActivity(intent)
340 } catch (ex3: ActivityNotFoundException) {
341 ex3.printStackTrace()
351 * Olympus Cameraクラスとのやりとりをするクラスを準備する
352 * (カメラとの接続も、ここでスレッドを起こして開始する)
354 private fun setupCameraCoordinator()
358 preferences = PreferenceAccessWrapper(this)
359 preferences.initialize()
360 val connectionMethod = preferences.getString(
361 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD,
362 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE
364 if (liveView == null)
366 liveView = findViewById(R.id.liveview)
367 liveView?.visibility = View.VISIBLE
369 if (liveView != null)
371 liveViewListener = CameraLiveViewListenerImpl(liveView!!)
375 glView = findViewById(R.id.glview)
379 if (gestureParser == null)
381 gestureParser = GestureParser(applicationContext, glView!!)
383 enableGlView = preferences.getBoolean(IPreferenceCameraPropertyAccessor.THETA_GL_VIEW, false)
384 if (enableGlView && connectionMethod.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA))
387 glView?.setImageProvider(liveViewListener!!)
388 glView?.visibility = View.VISIBLE
389 liveView?.visibility = View.GONE
392 olyAirCoordinator = OlyCameraCoordinator(this, liveView, this, this)
393 thetaCoordinator = ThetaCameraController(this, this, this)
395 if (connectionMethod.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA)) thetaCoordinator else olyAirCoordinator
396 currentCoordinator?.setLiveViewListener(liveViewListener!!)
397 listener = CameraLiveViewOnTouchListener(
398 this, currentCoordinator?.getFeatureDispatcher(
400 currentCoordinator!!,
405 selectionDialog = FavoriteSettingSelectionDialog(
407 currentCoordinator?.cameraPropertyLoadSaveOperations,
411 } catch (e: Exception) {
420 private fun connectToCamera()
422 val thread = Thread { currentCoordinator?.connectionInterface?.connect() }
434 * カメラの電源をOFFいして、アプリを抜ける処理
437 override fun exitApplication()
440 Log.v(TAG, "exitApplication()")
442 // パワーマネージャを確認し、interactive modeではない場合は、ライブビューも止めず、カメラの電源も切らない
443 if (powerManager?.isInteractive != true)
445 Log.v(TAG, "not interactive, keep liveview.")
450 currentCoordinator?.stopLiveView()
453 val watcher = currentCoordinator?.statusWatcher
454 watcher?.stopStatusWatch()
456 // パラメータを確認し、カメラの電源を切る
457 if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
458 IPreferenceCameraPropertyAccessor.EXIT_APPLICATION_WITH_DISCONNECT,
462 Log.v(TAG, "Shutdown camera...")
465 currentCoordinator?.connectionInterface?.disconnect(true)
468 //finishAndRemoveTask();
469 //android.os.Process.killProcess(android.os.Process.myPid());
470 } catch (e: Exception) {
478 override fun checkConnectionFeature(id: Int, btnId: Int): Boolean
484 ret = launchWifiSettingScreen()
485 } else if (id == 1) {
487 changeConnectionMethod()
495 * @param posX X座標位置 (0.0f - 1.0f)
496 * @param posY Y座標位置 (0.0f - 1.0f)
497 * @return true / false
499 override fun touchedPosition(posX: Float, posY: Float): Boolean
501 Log.v(TAG, "touchedPosition ($posX, $posY)")
502 return (liveView?.touchedPosition(posX, posY) ?: false)
508 override fun showConnectionStatus(): Boolean
512 if (listener?.isEnabledOperation == operation.ONLY_CONNECT && cameraDisconnectedHappened) {
513 // カメラが切断されたとき、再接続を指示する
515 cameraDisconnectedHappened = false
529 override fun onStatusNotify(message: String)
531 setMessage(IShowInformation.AREA_C, Color.WHITE, message)
537 override fun onCameraConnected()
539 Log.v(TAG, "onCameraConnected()")
542 // ライブビューの開始 & タッチ/ボタンの操作を可能にする
543 currentCoordinator?.connectFinished()
544 currentCoordinator?.startLiveView()
545 currentCoordinator?.setRecViewMode(false)
546 listener!!.setEnableOperation(operation.ENABLE)
547 setMessage(IShowInformation.AREA_C, Color.WHITE, "")
548 currentCoordinator?.updateStatusAll()
549 val watcher = currentCoordinator?.statusWatcher
550 watcher?.startStatusWatch()
559 * カメラとの接続が切れたとき...何もしない
562 override fun onCameraDisconnected()
564 Log.v(TAG, "onCameraDisconnected()")
568 IShowInformation.AREA_C,
570 getString(R.string.camera_disconnected)
572 listener?.setEnableOperation(operation.ONLY_CONNECT)
573 cameraDisconnectedHappened = true
584 override fun onCameraConnectError(message: String)
586 Log.v(TAG, "onCameraOccursException()")
589 setMessage(IShowInformation.AREA_C, Color.YELLOW, message)
590 listener?.setEnableOperation(operation.ONLY_CONNECT)
591 cameraDisconnectedHappened = true
593 catch (ee: Exception)
602 override fun onCameraOccursException(message: String, e: Exception)
604 Log.v(TAG, "onCameraOccursException()")
607 setMessage(IShowInformation.AREA_C, Color.YELLOW, message)
608 listener?.setEnableOperation(operation.ONLY_CONNECT)
609 cameraDisconnectedHappened = true
611 catch (ee: Exception)
621 * @param area 表示エリア (AREA_1 ~ AREA_6, AREA_C)
623 * @param message 表示するメッセージ
625 override fun setMessage(area: Int, color: Int, message: String)
629 IShowInformation.AREA_1 -> {
631 setMessage(IShowInformation.AREA_1_2, color, message)
633 IShowInformation.AREA_2 -> {
635 setMessage(IShowInformation.AREA_2_2, color, message)
637 IShowInformation.AREA_3 -> {
639 setMessage(IShowInformation.AREA_3_2, color, message)
641 IShowInformation.AREA_4 -> {
643 setMessage(IShowInformation.AREA_4_2, color, message)
644 setMessage(IShowInformation.AREA_5_2, color, message)
646 IShowInformation.AREA_1_2 -> id = R.id.text_11
647 IShowInformation.AREA_2_2 -> id = R.id.text_12
648 IShowInformation.AREA_3_2 -> id = R.id.text_13
649 IShowInformation.AREA_4_2 -> id = R.id.text_14
650 IShowInformation.AREA_5_2 -> id = R.id.text_15
651 IShowInformation.AREA_NONE -> {}
655 if (messageDrawer != null)
657 if (area == IShowInformation.AREA_C)
659 messageDrawer?.setMessageToShow(
660 IMessageDrawer.MessageArea.CENTER,
662 IMessageDrawer.SIZE_LARGE,
667 if (area == IShowInformation.AREA_5)
669 messageDrawer?.setMessageToShow(
670 IMessageDrawer.MessageArea.UPLEFT,
672 IMessageDrawer.SIZE_STD,
677 if (area == IShowInformation.AREA_6)
679 messageDrawer?.setMessageToShow(
680 IMessageDrawer.MessageArea.LOWLEFT,
682 IMessageDrawer.SIZE_STD,
687 if (area == IShowInformation.AREA_7)
689 messageDrawer?.setMessageToShow(
690 IMessageDrawer.MessageArea.UPRIGHT,
692 IMessageDrawer.SIZE_STD,
697 if (area == IShowInformation.AREA_8)
699 messageDrawer?.setMessageToShow(
700 IMessageDrawer.MessageArea.LOWRIGHT,
702 IMessageDrawer.SIZE_STD,
707 if (area == IShowInformation.AREA_9)
709 messageDrawer?.setMessageToShow(
710 IMessageDrawer.MessageArea.UPCENTER,
712 IMessageDrawer.SIZE_STD,
717 if (area == IShowInformation.AREA_A)
719 messageDrawer?.setMessageToShow(
720 IMessageDrawer.MessageArea.LOWCENTER,
722 IMessageDrawer.SIZE_STD,
727 if (area == IShowInformation.AREA_B)
729 messageDrawer?.setMessageToShow(
730 IMessageDrawer.MessageArea.CENTERLEFT,
732 IMessageDrawer.SIZE_STD,
737 if (area == IShowInformation.AREA_D)
739 messageDrawer?.setMessageToShow(
740 IMessageDrawer.MessageArea.CENTERRIGHT,
742 IMessageDrawer.SIZE_STD,
755 val textArea = findViewById<TextView>(areaId)
756 if (textArea != null)
758 textArea.setTextColor(color)
759 textArea.text = message
760 textArea.invalidate()
768 * @param button ボタンの場所
769 * @param labelId 変更する内容
771 override fun setButtonDrawable(button: Int, labelId: Int)
773 val id = when (button)
775 IShowInformation.BUTTON_1 -> R.id.btn_1
776 IShowInformation.BUTTON_2 -> R.id.btn_2
777 IShowInformation.BUTTON_3 -> R.id.btn_3
778 IShowInformation.BUTTON_4 -> R.id.btn_4
779 IShowInformation.BUTTON_5 -> R.id.btn_5
780 IShowInformation.BUTTON_6 -> R.id.btn_6
781 IShowInformation.BUTTON_7 -> R.id.btn_025
782 IShowInformation.BUTTON_8 -> R.id.btn_026
788 val btn = findViewById<ImageButton>(id)
789 val drawTarget = ContextCompat.getDrawable(applicationContext, labelId)
792 btn.setImageDrawable(drawTarget)
805 * @return true GPS搭載, false GPS非搭載
807 private fun hasGps(): Boolean
809 return (packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS))
818 override fun dispatchTouchEvent(event: MotionEvent): Boolean
820 //Log.v(TAG, " dispatchTouchEvent() ");
823 //Log.v(TAG, " onTouch() ");
824 gestureParser?.onTouch(event)
826 return (super.dispatchTouchEvent(event))
829 override fun vibrate(vibratePattern: Int)
834 val vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
836 val vibratorManager = this.getSystemService(VIBRATOR_MANAGER_SERVICE) as VibratorManager
837 vibratorManager.defaultVibrator
841 @Suppress("DEPRECATION")
842 getSystemService(VIBRATOR_SERVICE) as Vibrator
844 if (!vibrator.hasVibrator())
846 Log.v(TAG, " not have Vibrator...")
849 @Suppress("DEPRECATION") val thread = Thread {
852 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
854 vibrator.vibrate(VibrationEffect.createOneShot(30, VibrationEffect.DEFAULT_AMPLITUDE))
858 when (vibratePattern)
860 IShowInformation.VIBRATE_PATTERN_SIMPLE_SHORT -> vibrator.vibrate(30)
861 IShowInformation.VIBRATE_PATTERN_SIMPLE_MIDDLE -> vibrator.vibrate(80)
862 IShowInformation.VIBRATE_PATTERN_SIMPLE_LONG -> vibrator.vibrate(150)
863 IShowInformation.VIBRATE_PATTERN_SIMPLE_LONGLONG -> vibrator.vibrate(300)
864 IShowInformation.VIBRATE_PATTERN_SHORT_DOUBLE -> {
865 val pattern = longArrayOf(10, 35, 30, 35, 0)
866 vibrator.vibrate(pattern, -1)
872 catch (e : Exception)
879 catch (e: java.lang.Exception)
885 override fun setEnabledOperation(operation: operation)
887 listener?.setEnableOperation(operation)
894 override fun showFavoriteSettingsDialog()
896 if ((liveView != null)&&(listener != null)&&(listener!!.isEnabledOperation != operation.ONLY_CONNECT))
898 listener?.setEnableOperation(operation.ENABLE_ONLY_TOUCHED_POSITION)
899 liveView?.showDialog(selectionDialog)
903 override fun showToast(rscId: Int, appendMessage: String, duration: Int)
910 val message = if (rscId != 0) getString(rscId) + appendMessage else appendMessage
911 Toast.makeText(applicationContext, message, duration).show()
925 override fun invalidate()
929 runOnUiThread { liveView?.invalidate() }
941 override fun dialogDismissed(isExecuted: Boolean)
945 if ((liveView != null) && (listener != null))
947 liveView?.hideDialog()
948 listener?.setEnableOperation(operation.ENABLE)
957 private fun updateConnectionMethodMessage()
961 val connectionMethod = preferences.getString(
962 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD,
963 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE
965 val methodId = if (connectionMethod.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA)) R.string.connection_method_theta else R.string.connection_method_opc
966 setMessage(IShowInformation.AREA_7, Color.MAGENTA, getString(methodId))
967 liveView?.setupInitialBackgroundImage(this)
968 liveView?.visibility = View.VISIBLE
969 liveView?.invalidate()
977 private fun updateConnectionMethod(parameter: String, method: ICameraController?)
981 currentCoordinator = method
982 preferences.putString(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD, parameter)
983 vibrate(IShowInformation.VIBRATE_PATTERN_SHORT_DOUBLE)
984 enableGlView = preferences.getBoolean(IPreferenceCameraPropertyAccessor.THETA_GL_VIEW, false)
985 if ((enableGlView)&&(parameter.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA)))
990 glView = findViewById(R.id.glview)
995 gestureParser = GestureParser(applicationContext, glView!!)
996 glView?.setImageProvider(liveViewListener!!)
997 glView?.visibility = View.VISIBLE
998 liveView?.visibility = View.GONE
1003 if (liveView == null)
1005 liveView = findViewById(R.id.liveview)
1007 if (liveView != null)
1009 glView?.visibility = View.GONE
1010 liveView?.visibility = View.VISIBLE
1014 catch (e: Exception)
1021 * 接続方式を変更するか確認する (OPC ⇔ THETA)
1024 private fun changeConnectionMethod() {
1025 val activity: AppCompatActivity = this
1028 var titleId = R.string.change_title_from_opc_to_theta
1029 var messageId = R.string.change_message_from_opc_to_theta
1031 val connectionMethod = preferences.getString(
1032 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD,
1033 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_DEFAULT_VALUE
1035 if (connectionMethod.contains(IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA)) {
1036 titleId = R.string.change_title_from_theta_to_opc
1037 messageId = R.string.change_message_from_theta_to_opc
1040 val isTheta = method
1041 val confirmation = ConfirmationDialog(activity)
1042 confirmation.show(titleId, messageId) {
1043 Log.v(TAG, " --- CONFIRMED! --- (theta:$isTheta)")
1046 updateConnectionMethod(
1047 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_OPC,
1051 // 接続方式を Theta に切り替える
1052 updateConnectionMethod(
1053 IPreferenceCameraPropertyAccessor.CONNECTION_METHOD_THETA,
1057 updateConnectionMethodMessage()
1059 } catch (e: Exception) {
1065 override fun onConnectedToWifi()
1069 Log.v(TAG, "onConnectedToWifi()")
1071 catch (e: Exception)
1079 private val TAG = MainActivity::class.java.simpleName
1080 //const val REQUEST_NEED_PERMISSIONS = 1010
1081 private const val REQUEST_CODE_PERMISSIONS = 10
1082 private val REQUIRED_PERMISSIONS = arrayOf(
1083 Manifest.permission.VIBRATE,
1084 Manifest.permission.WAKE_LOCK,
1085 Manifest.permission.INTERNET,
1086 Manifest.permission.ACCESS_NETWORK_STATE,
1087 Manifest.permission.ACCESS_WIFI_STATE,
1088 Manifest.permission.CHANGE_WIFI_STATE,
1089 Manifest.permission.CHANGE_NETWORK_STATE,
1090 Manifest.permission.CHANGE_WIFI_MULTICAST_STATE,