|
@@ -79,6 +79,7 @@ import java.io.*
|
|
|
import java.lang.Process
|
|
|
import java.lang.ref.WeakReference
|
|
|
import java.util.*
|
|
|
+import java.util.concurrent.Executors
|
|
|
import java.util.concurrent.TimeUnit
|
|
|
import kotlin.collections.ArrayList
|
|
|
|
|
@@ -197,17 +198,10 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
|
|
|
}
|
|
|
|
|
|
override fun init() {
|
|
|
- //开始ping网络,30秒ping一次
|
|
|
- //NetHelper.startNetCheck()
|
|
|
|
|
|
//获取mac地址
|
|
|
Constant.LOCAL_MAC = NetHelper.getInstance().macAddress
|
|
|
|
|
|
- //presenter.loadTcpServerHost()
|
|
|
-
|
|
|
- //sip初始化
|
|
|
- //initSip()
|
|
|
-
|
|
|
//注册广播
|
|
|
regReceiver()
|
|
|
//串口监听
|
|
@@ -244,6 +238,8 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
|
|
|
//打开网络调试
|
|
|
AppTool.Time.delay(120000) {
|
|
|
AppUtil.openNetworkDebug()
|
|
|
+
|
|
|
+ checkAppVersion()
|
|
|
}
|
|
|
|
|
|
//卸载原来二代系统床头分机apk
|
|
@@ -614,6 +610,20 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
|
|
|
}
|
|
|
}
|
|
|
}).start()
|
|
|
+
|
|
|
+ startTimingRefreshData()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun startTimingRefreshData() {
|
|
|
+ val timerTask: TimerTask = object : TimerTask() {
|
|
|
+ override fun run() {
|
|
|
+ if (Constant.TCP_CONNECTED) {
|
|
|
+ initDevice()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ val executor = Executors.newSingleThreadScheduledExecutor()
|
|
|
+ executor.scheduleAtFixedRate(timerTask, 10, 30, TimeUnit.MINUTES)
|
|
|
}
|
|
|
|
|
|
//显示设备信息
|
|
@@ -786,7 +796,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
|
|
|
resetSleepTime()
|
|
|
|
|
|
supportFragmentManager.beginTransaction()
|
|
|
- .setCustomAnimations(R.anim.push_left_in, R.anim.push_left_out)
|
|
|
+ //.setCustomAnimations(R.anim.push_left_in, R.anim.push_left_out)
|
|
|
.replace(layId, fragment, tag)
|
|
|
.commitAllowingStateLoss()
|
|
|
curFragment = tag
|
|
@@ -1511,40 +1521,12 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
|
|
|
AppUtil.setSysTime(timeStr, timeZone)
|
|
|
Log.d("setTime", "set sys time2: $timeStr, $timeZone")
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- //探视
|
|
|
- /*if (tcpModel.type == TcpType.VIDEO) {
|
|
|
- val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
|
- if (tcpModel.action == TcpAction.VideoAction.VIDEO_INVITE_JOIN) {
|
|
|
- if (Constant.CALL_STATE != Constant.CALL_STANDBY) {
|
|
|
- VideoUtil.videoInCalling(Constant.DEVICE_ID, tcpModel.fromId, interactionVO.id)
|
|
|
- } else {
|
|
|
- //收到探视请求,向探视机发起视频通话
|
|
|
- Constant.interactionId = interactionVO.id
|
|
|
- Constant.fromId = tcpModel.fromId
|
|
|
- Constant.CALL_STATE = Constant.CALL_OUTGOING
|
|
|
-
|
|
|
- //通话之前先判断webrtc socket是否连接上,否则不能建立通话
|
|
|
- if (Constant.TCP_CONNECTED) {
|
|
|
- //探视界面
|
|
|
- var fragment = SkyCallFragment()
|
|
|
- var bundle = Bundle()
|
|
|
- bundle.putInt("call_state", 2)
|
|
|
- bundle.putSerializable("tcp_model", tcpModel)
|
|
|
- fragment.arguments = bundle
|
|
|
- addCallFragment(fragment)
|
|
|
- } else {
|
|
|
- showMessage("服务未连接,请稍后")
|
|
|
- Constant.CALL_STATE = Constant.CALL_STANDBY
|
|
|
- VoiceUtil.rejectAudioCall(Constant.DEVICE_ID, Constant.fromId, Constant.interactionId)
|
|
|
- }
|
|
|
+ if (Constant.TCP_CONNECTED) {
|
|
|
+ initDevice()
|
|
|
}
|
|
|
- } else if (tcpModel.action == TcpAction.VideoAction.HANDOFF) {
|
|
|
- Constant.CALL_STATE = Constant.CALL_STANDBY
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1634,12 +1616,6 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
|
|
|
val calendar = Calendar.getInstance()
|
|
|
val hour = calendar[Calendar.HOUR_OF_DAY]
|
|
|
val minute = calendar[Calendar.MINUTE]
|
|
|
- if (minute == 0) {
|
|
|
- //每到整点检查一下床位是否有入住,若没有则拉一下数据,防止数据未刷新到
|
|
|
- if (Constant.TCP_CONNECTED && Constant.CUSTOM_ID == -1) {
|
|
|
- initDevice()
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/*
|
|
|
* 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
|