|
@@ -29,7 +29,9 @@ import com.develop.common.utils.compat.StartViewCompat
|
|
|
import com.drake.net.convert.NetConverter
|
|
|
import com.drake.net.interceptor.RequestInterceptor
|
|
|
import com.drake.net.interfaces.NetErrorHandler
|
|
|
+import com.drake.net.time.Interval
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevStatus
|
|
|
+import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevPromptEvent
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevStatusEvent
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
|
|
|
import org.alee.component.skin.compat.ConstraintLayoutCompat
|
|
@@ -38,9 +40,11 @@ import org.alee.component.skin.service.Config
|
|
|
import org.alee.component.skin.service.IOptionFactory
|
|
|
import org.alee.component.skin.service.IThemeSkinOption
|
|
|
import org.alee.component.skin.service.ThemeSkinService
|
|
|
+import org.greenrobot.eventbus.EventBus
|
|
|
import org.greenrobot.eventbus.Subscribe
|
|
|
import java.io.File
|
|
|
import java.lang.reflect.Method
|
|
|
+import java.util.concurrent.TimeUnit
|
|
|
|
|
|
|
|
|
class FoodCookingApp : BaseApp() {
|
|
@@ -59,6 +63,7 @@ class FoodCookingApp : BaseApp() {
|
|
|
var mWakeLock: PowerManager.WakeLock? = null
|
|
|
private lateinit var pm: PowerManager
|
|
|
var minute = 0
|
|
|
+ private lateinit var heartBeatInterval :Interval
|
|
|
override fun onCreate() {
|
|
|
hookWebView()
|
|
|
super.onCreate()
|
|
@@ -97,6 +102,16 @@ class FoodCookingApp : BaseApp() {
|
|
|
val uri: Uri = Settings.System
|
|
|
.getUriFor(Settings.System.SCREEN_OFF_TIMEOUT)
|
|
|
contentResolver.notifyChange(uri, null)
|
|
|
+ heartBeatInterval = Interval(1,1,TimeUnit.SECONDS,5).finish {
|
|
|
+ //设备不通讯异常
|
|
|
+ EventBus.getDefault().post(
|
|
|
+ DevPromptEvent.builder()
|
|
|
+ .showCancelBtn(false)
|
|
|
+ .msg("dev_error")
|
|
|
+ .focus(true)
|
|
|
+ .build()
|
|
|
+ )
|
|
|
+ }.start()
|
|
|
}
|
|
|
|
|
|
|
|
@@ -171,6 +186,7 @@ class FoodCookingApp : BaseApp() {
|
|
|
@Subscribe
|
|
|
@Synchronized
|
|
|
fun globalCoverEvent(event: DevStatusEvent) {
|
|
|
+ heartBeatInterval.stop()
|
|
|
val devInfo = event.devInfo;
|
|
|
val pm = getSystemService(POWER_SERVICE) as PowerManager
|
|
|
if (devInfo.status == DevStatus.RUNNING.toInt() || devInfo.isWeightStatus) {
|