OSDN Git Service

1枚撮影ができるようになった。
[gokigen/A01c.git] / wear / src / main / java / jp / sfjp / gokigen / a01c / thetacamerawrapper / ThetaCameraController.kt
1 package jp.sfjp.gokigen.a01c.thetacamerawrapper
2
3 import android.util.Log
4 import android.view.MotionEvent
5 import androidx.appcompat.app.AppCompatActivity
6 import androidx.preference.PreferenceDataStore
7 import jp.sfjp.gokigen.a01c.ICameraConnection
8 import jp.sfjp.gokigen.a01c.ICameraController
9 import jp.sfjp.gokigen.a01c.ICameraFeatureDispatcher
10 import jp.sfjp.gokigen.a01c.IShowInformation
11 import jp.sfjp.gokigen.a01c.liveview.CameraLiveViewListenerImpl
12 import jp.sfjp.gokigen.a01c.liveview.IAutoFocusFrameDisplay
13 import jp.sfjp.gokigen.a01c.liveview.ICameraStatusReceiver
14 import jp.sfjp.gokigen.a01c.liveview.ILiveImageStatusNotify
15 import jp.sfjp.gokigen.a01c.olycamerawrapper.ICameraRunMode
16 import jp.sfjp.gokigen.a01c.olycamerawrapper.IIndicatorControl
17 import jp.sfjp.gokigen.a01c.olycamerawrapper.ILevelGauge
18 import jp.sfjp.gokigen.a01c.olycamerawrapper.IZoomLensHolder
19 import jp.sfjp.gokigen.a01c.olycamerawrapper.property.ICameraPropertyLoadSaveOperations
20 import jp.sfjp.gokigen.a01c.olycamerawrapper.property.ILoadSaveCameraProperties
21 import jp.sfjp.gokigen.a01c.olycamerawrapper.property.IOlyCameraPropertyProvider
22 import jp.sfjp.gokigen.a01c.preference.PreferenceAccessWrapper
23 import jp.sfjp.gokigen.a01c.thetacamerawrapper.connection.ThetaCameraConnection
24 import jp.sfjp.gokigen.a01c.thetacamerawrapper.liveview.ThetaLiveViewControl
25 import jp.sfjp.gokigen.a01c.thetacamerawrapper.operation.ThetaDummyOperation
26 import jp.sfjp.gokigen.a01c.thetacamerawrapper.operation.ThetaSingleShotControl
27
28 class ThetaCameraController(val context: AppCompatActivity, private val focusFrameDisplay: IAutoFocusFrameDisplay, private val showInformation: IShowInformation, private val receiver: ICameraStatusReceiver, private val preferences: PreferenceAccessWrapper) : ICameraController, IIndicatorControl
29 {
30     private lateinit var featureDispatcher : ThetaFeatureDispatcher
31     private lateinit var liveViewControl : ThetaLiveViewControl
32     private val dummyOperation = ThetaDummyOperation()
33     private val sessionIdHolder = ThetaSessionHolder()
34     private val cameraConnection = ThetaCameraConnection(context, receiver, sessionIdHolder)
35     private val singleShot = ThetaSingleShotControl(sessionIdHolder, this, this)
36
37     override fun setLiveViewListener(listener: CameraLiveViewListenerImpl)
38     {
39         this.liveViewControl = ThetaLiveViewControl(sessionIdHolder, listener)
40     }
41
42     override fun changeLiveViewSize(size: String?)
43     {
44         // ログだけ残す
45         Log.v(toString(), " changeLiveViewSize: $size")
46     }
47
48     override fun startLiveView()
49     {
50         if (::liveViewControl.isInitialized)
51         {
52             liveViewControl.startLiveView()
53         }
54     }
55
56     override fun stopLiveView()
57     {
58         if (::liveViewControl.isInitialized)
59         {
60             liveViewControl.stopLiveView()
61         }
62     }
63
64     override fun updateTakeMode()
65     {
66         // なにもしない
67     }
68
69     override fun driveAutoFocus(event: MotionEvent?): Boolean
70     {
71         return (true)
72     }
73
74     override fun unlockAutoFocus()
75     {
76         // なにもしない
77     }
78
79     override fun isContainsAutoFocusPoint(event: MotionEvent?): Boolean
80     {
81         return (false)
82     }
83
84     override fun singleShot()
85     {
86         singleShot.singleShot(sessionIdHolder.isApiLevelV21())
87     }
88
89     override fun movieControl()
90     {
91         // TODO("Not yet implemented")
92     }
93
94     override fun bracketingShot(bracketingStyle: Int, bracketingCount: Int, durationSeconds: Int)
95     {
96         // TODO("Not yet implemented")
97     }
98
99     override fun setRecViewMode(isRecViewMode: Boolean)
100     {
101         // なにもしない
102     }
103
104     override fun toggleAutoExposure()
105     {
106         // なにもしない
107     }
108
109     override fun toggleManualFocus()
110     {
111         // なにもしない
112     }
113
114     override fun isManualFocus(): Boolean
115     {
116         return (false)
117     }
118
119     override fun isAFLock(): Boolean
120     {
121         return (false)
122     }
123
124     override fun isAELock(): Boolean
125     {
126         return (false)
127     }
128
129     override fun updateStatusAll()
130     {
131         // なにもしない
132     }
133
134     override fun getCameraPropertyProvider(): IOlyCameraPropertyProvider
135     {
136         return (dummyOperation)
137     }
138
139     override fun getCameraPropertyLoadSaveOperations(): ICameraPropertyLoadSaveOperations
140     {
141         return (dummyOperation)
142     }
143
144     override fun getLoadSaveCameraProperties(): ILoadSaveCameraProperties
145     {
146         return (dummyOperation)
147     }
148
149     override fun getChangeRunModeExecutor(): ICameraRunMode
150     {
151         return (dummyOperation)
152     }
153
154     override fun getConnectionInterface(): ICameraConnection
155     {
156         return (cameraConnection)
157     }
158
159     override fun getZoomLensHolder(): IZoomLensHolder
160     {
161         return (dummyOperation)
162     }
163
164     override fun getLevelGauge(): ILevelGauge
165     {
166         return (dummyOperation)
167     }
168
169     override fun getFeatureDispatcher(context: AppCompatActivity, statusDrawer: IShowInformation, camera: ICameraController, accessWrapper: PreferenceDataStore, liveImageView: ILiveImageStatusNotify): ICameraFeatureDispatcher
170     {
171         if (!(::featureDispatcher.isInitialized))
172         {
173             featureDispatcher = ThetaFeatureDispatcher(context, statusDrawer, camera, accessWrapper, liveImageView)
174         }
175         return (featureDispatcher)
176     }
177
178     override fun onAfLockUpdate(isAfLocked: Boolean)
179     {
180         //TODO("Not yet implemented")
181     }
182
183     override fun onShootingStatusUpdate(status: IIndicatorControl.shootingStatus?)
184     {
185         //TODO("Not yet implemented")
186     }
187 }