|
|
@ -26,6 +26,7 @@ import com.yinuo.safetywatcher.watcher.utils.BatteryHelper
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.GPIOUtils
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.GPIOUtils
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.RecordHelper
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.RecordHelper
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.SimHelper
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.SimHelper
|
|
|
|
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.SpeedUtils
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.WifiHelper
|
|
|
|
import com.yinuo.safetywatcher.watcher.utils.WifiHelper
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
import kotlinx.coroutines.GlobalScope
|
|
|
|
import kotlinx.coroutines.GlobalScope
|
|
|
@ -83,12 +84,30 @@ class HomeActivity : NoOptionsActivity() {
|
|
|
|
if (isChecked) onCameraOpen() else onCameraClose()
|
|
|
|
if (isChecked) onCameraOpen() else onCameraClose()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemPump.setOnClickListener {
|
|
|
|
|
|
|
|
pumpSwitch.performClick()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pumpSwitch.setOnCheckedChangeListener { buttonView, isChecked ->
|
|
|
|
|
|
|
|
if (isChecked) onPumpOpen() else onPumpClose()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
itemSetting.post {
|
|
|
|
itemSetting.post {
|
|
|
|
itemSetting.requestFocus()
|
|
|
|
itemSetting.requestFocus()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun onPumpClose() {
|
|
|
|
|
|
|
|
SpeedUtils.setSpeed(0)
|
|
|
|
|
|
|
|
GasPortUtils.setSpeed(0)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun onPumpOpen() {
|
|
|
|
|
|
|
|
val localSpeed = SpeedUtils.getLocalSpeed()
|
|
|
|
|
|
|
|
SpeedUtils.setSpeed(localSpeed)
|
|
|
|
|
|
|
|
GasPortUtils.setSpeed(localSpeed)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun onCameraOpen() {
|
|
|
|
private fun onCameraOpen() {
|
|
|
|
// 启动录制编码
|
|
|
|
// 启动录制编码
|
|
|
|
RecordHelper.startRecording()
|
|
|
|
RecordHelper.startRecording()
|
|
|
|