|
@@ -113,6 +113,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
private var bedCalls = ArrayList<CallingItem>()
|
|
private var bedCalls = ArrayList<CallingItem>()
|
|
|
|
|
|
private val handler by lazy { Handler(Looper.getMainLooper()) }
|
|
private val handler by lazy { Handler(Looper.getMainLooper()) }
|
|
|
|
+ private val checkHandler by lazy { Handler(Looper.getMainLooper()) }
|
|
|
|
|
|
//网络异常计数
|
|
//网络异常计数
|
|
private var netErrCount : Int = 0
|
|
private var netErrCount : Int = 0
|
|
@@ -364,8 +365,15 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
val response = okHttpClient.newCall(request).execute()
|
|
val response = okHttpClient.newCall(request).execute()
|
|
if (response != null && response.isSuccessful) {
|
|
if (response != null && response.isSuccessful) {
|
|
//接口数据获取成功,进入下一步获取设备信息
|
|
//接口数据获取成功,进入下一步获取设备信息
|
|
- serverSuccess = true
|
|
|
|
presenter.loadServerInfo()
|
|
presenter.loadServerInfo()
|
|
|
|
+
|
|
|
|
+ //延迟30s判断服务器数据和设备信息是否获取成功,否则重试
|
|
|
|
+ checkHandler.removeCallbacksAndMessages(null)
|
|
|
|
+ checkHandler.postDelayed({
|
|
|
|
+ if (loaded && initialized) {
|
|
|
|
+ serverSuccess = true
|
|
|
|
+ }
|
|
|
|
+ }, 30000)
|
|
} else {
|
|
} else {
|
|
//接口数据获取失败,可能服务器ip不对,尝试重新获取服务器ip
|
|
//接口数据获取失败,可能服务器ip不对,尝试重新获取服务器ip
|
|
val info = ServerInfoUtil.get(Constant.DEVICE_REGISTER_ID!!)
|
|
val info = ServerInfoUtil.get(Constant.DEVICE_REGISTER_ID!!)
|
|
@@ -379,7 +387,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
- Thread.sleep(30000)
|
|
|
|
|
|
+ Thread.sleep(45000)
|
|
} catch (ex: Exception) {
|
|
} catch (ex: Exception) {
|
|
ex.printStackTrace()
|
|
ex.printStackTrace()
|
|
}
|
|
}
|
|
@@ -719,6 +727,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
SerialPortUtil.getInstance().closeHeart()
|
|
SerialPortUtil.getInstance().closeHeart()
|
|
SerialPortUtil.getInstance().closeSerialPort()
|
|
SerialPortUtil.getInstance().closeSerialPort()
|
|
}
|
|
}
|
|
|
|
+ handler.removeCallbacksAndMessages(null)
|
|
}
|
|
}
|
|
|
|
|
|
//数据加载错误
|
|
//数据加载错误
|
|
@@ -799,18 +808,26 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
SettingConfig.setNetErrResetCount(this, 0)
|
|
SettingConfig.setNetErrResetCount(this, 0)
|
|
|
|
|
|
- Thread(Runnable {
|
|
|
|
|
|
+ Thread {
|
|
while (!initialized) {
|
|
while (!initialized) {
|
|
- runOnUiThread(Runnable {
|
|
|
|
|
|
+ runOnUiThread {
|
|
initDevice()
|
|
initDevice()
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
try {
|
|
try {
|
|
- Thread.sleep(20000)
|
|
|
|
|
|
+ Thread.sleep(25000)
|
|
} catch (e: Exception) {
|
|
} catch (e: Exception) {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }).start()
|
|
|
|
|
|
+ }.start()
|
|
|
|
+
|
|
|
|
+ //30s后检查版本
|
|
|
|
+ handler.postDelayed({
|
|
|
|
+ //检查版本
|
|
|
|
+ Constant.silentUpdate = true
|
|
|
|
+ checkAppVersion()
|
|
|
|
+ }, 30000)
|
|
}
|
|
}
|
|
|
|
|
|
//显示设备信息
|
|
//显示设备信息
|
|
@@ -874,10 +891,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
WdklSipService.getCore().defaultProxyConfig = cfg
|
|
WdklSipService.getCore().defaultProxyConfig = cfg
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- //检查版本
|
|
|
|
- Constant.silentUpdate = true
|
|
|
|
- checkAppVersion()
|
|
|
|
}
|
|
}
|
|
|
|
|
|
override fun setPartSettings(partSetting: PartSettingDO) {
|
|
override fun setPartSettings(partSetting: PartSettingDO) {
|