|
@@ -7,7 +7,6 @@ import android.content.pm.PackageManager
|
|
import android.graphics.Color
|
|
import android.graphics.Color
|
|
import android.media.AudioManager
|
|
import android.media.AudioManager
|
|
import android.net.ConnectivityManager
|
|
import android.net.ConnectivityManager
|
|
-import android.net.Uri
|
|
|
|
import android.nfc.NfcAdapter
|
|
import android.nfc.NfcAdapter
|
|
import android.nfc.Tag
|
|
import android.nfc.Tag
|
|
import android.os.*
|
|
import android.os.*
|
|
@@ -49,12 +48,9 @@ import com.wdkl.app.ncs.callingdoor.fragment.NurseFragment
|
|
import com.wdkl.app.ncs.callingdoor.fragment.YhFragment
|
|
import com.wdkl.app.ncs.callingdoor.fragment.YhFragment
|
|
import com.wdkl.ncs.android.lib.base.BaseActivity
|
|
import com.wdkl.ncs.android.lib.base.BaseActivity
|
|
import com.wdkl.ncs.android.lib.base.BaseApplication
|
|
import com.wdkl.ncs.android.lib.base.BaseApplication
|
|
-import com.wdkl.ncs.android.lib.netdetection.ui.NetDetectActivity
|
|
|
|
import com.wdkl.ncs.android.lib.utils.*
|
|
import com.wdkl.ncs.android.lib.utils.*
|
|
import com.wdkl.ncs.android.lib.utils.TimeHandle.convertTimeToMilliseconds
|
|
import com.wdkl.ncs.android.lib.utils.TimeHandle.convertTimeToMilliseconds
|
|
import com.wdkl.ncs.android.lib.vo.filter
|
|
import com.wdkl.ncs.android.lib.vo.filter
|
|
-import com.wdkl.ncs.android.lib.widget.MenuDialog
|
|
|
|
-import com.wdkl.ncs.android.middleware.api.ApiManager
|
|
|
|
import com.wdkl.ncs.android.middleware.api.UrlManager
|
|
import com.wdkl.ncs.android.middleware.api.UrlManager
|
|
import com.wdkl.ncs.android.middleware.common.Constant
|
|
import com.wdkl.ncs.android.middleware.common.Constant
|
|
import com.wdkl.ncs.android.middleware.common.MessageEvent
|
|
import com.wdkl.ncs.android.middleware.common.MessageEvent
|
|
@@ -74,7 +70,6 @@ import com.wdkl.ncs.android.middleware.tcp.channel.ImUtil
|
|
import com.wdkl.ncs.android.middleware.tcp.channel.OtherUtil
|
|
import com.wdkl.ncs.android.middleware.tcp.channel.OtherUtil
|
|
import com.wdkl.ncs.android.middleware.tcp.channel.VideoUtil
|
|
import com.wdkl.ncs.android.middleware.tcp.channel.VideoUtil
|
|
import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
|
|
import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
|
|
-import com.wdkl.ncs.android.middleware.tcp.dto.TcpCallback
|
|
|
|
import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
|
|
import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
|
|
import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
|
|
@@ -212,8 +207,6 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
override fun init() {
|
|
override fun init() {
|
|
instance = this
|
|
instance = this
|
|
//Utils.hideStatusBar(activity, false)
|
|
//Utils.hideStatusBar(activity, false)
|
|
- //打开串口设备
|
|
|
|
-// SerialPortUtil.getInstance().openSerialPortDCH()
|
|
|
|
mNfcAdapter= NfcUtils.getInstance().nfcAdapter
|
|
mNfcAdapter= NfcUtils.getInstance().nfcAdapter
|
|
NfcUtils.getInstance().setReadNdefListener(this)
|
|
NfcUtils.getInstance().setReadNdefListener(this)
|
|
Constant.NursingTitle =""
|
|
Constant.NursingTitle =""
|
|
@@ -742,7 +735,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
if (!TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
if (!TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
//没有摄像头则只能拨打语音
|
|
//没有摄像头则只能拨打语音
|
|
if (Constant.supportCamera) {
|
|
if (Constant.supportCamera) {
|
|
- CallTypeDialogHelper.showDialog(activity, object : CallTypeDialogHelper.ClickListener{
|
|
|
|
|
|
+ CallTypeDialogHelper.showDialog(activity, object : CallTypeDialogHelper.ClickListener {
|
|
override fun onVoiceClick() {
|
|
override fun onVoiceClick() {
|
|
startCall(Constant.VOICE_CALL)
|
|
startCall(Constant.VOICE_CALL)
|
|
}
|
|
}
|
|
@@ -806,7 +799,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
}
|
|
}
|
|
|
|
|
|
//设置串口监听
|
|
//设置串口监听
|
|
- private fun setSerialListener() {
|
|
|
|
|
|
+ public fun setSerialListener() {
|
|
SerialPortUtil.getInstance().setOnDataReceiveListener(this)
|
|
SerialPortUtil.getInstance().setOnDataReceiveListener(this)
|
|
SerialPortUtil.getInstance().setOnDataReceiveStringListener(this)
|
|
SerialPortUtil.getInstance().setOnDataReceiveStringListener(this)
|
|
|
|
|
|
@@ -1622,6 +1615,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
Util.wakeUpAndUnlock()
|
|
Util.wakeUpAndUnlock()
|
|
checkAppVersion()
|
|
checkAppVersion()
|
|
} else if (tcpModel.action == TcpAction.DeviceAction.RESTART) {
|
|
} else if (tcpModel.action == TcpAction.DeviceAction.RESTART) {
|
|
|
|
+ //后台做了重发此消息的机制.防止网络不好的时候没收到app重启,设备信息不刷新
|
|
|
|
+ if(!TextUtils.isEmpty(tcpModel.tid)) {
|
|
|
|
+ TcpClient.getInstance().sendMsg(tcpModel.toJson())
|
|
|
|
+ }
|
|
Util.wakeUpAndUnlock()
|
|
Util.wakeUpAndUnlock()
|
|
//收到重启app指令,若当前处于正常待机状态则直接重启app,否则等待通话结束再重启
|
|
//收到重启app指令,若当前处于正常待机状态则直接重启app,否则等待通话结束再重启
|
|
if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
@@ -1697,14 +1694,15 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (tcpModel.action == TcpAction.DataAction.INTERACTION
|
|
} else if (tcpModel.action == TcpAction.DataAction.INTERACTION
|
|
- || tcpModel.action == TcpAction.EventAction.RESPONSE
|
|
|
|
- || tcpModel.action == TcpAction.CallbackAction.SUCCESS
|
|
|
|
|
|
+ || tcpModel.action == TcpAction.EventAction.RESPONSE
|
|
|
|
+ || tcpModel.action == TcpAction.CallbackAction.SUCCESS
|
|
|
|
|
|
) {
|
|
) {
|
|
if (tcpModel.action == TcpAction.EventAction.RESPONSE && tcpModel.type.equals(TcpType.EVENT)) { //事件响应,语音播报已响应
|
|
if (tcpModel.action == TcpAction.EventAction.RESPONSE && tcpModel.type.equals(TcpType.EVENT)) { //事件响应,语音播报已响应
|
|
val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
if (!responsed.contains(interactionVO.id)) { //已响应过的事件不在播报
|
|
if (!responsed.contains(interactionVO.id)) { //已响应过的事件不在播报
|
|
- val speakStr = (interactionVO.actionEndMemberName ?: "") + "已响应" + interactionVO.data + "//请稍候"
|
|
|
|
|
|
+ val speakStr = (interactionVO.actionEndMemberName
|
|
|
|
+ ?: "") + "已响应" + interactionVO.data + "//请稍候"
|
|
SpeechUtil.getInstance().stopSpeak()
|
|
SpeechUtil.getInstance().stopSpeak()
|
|
SpeechUtil.getInstance().speak(speakStr)
|
|
SpeechUtil.getInstance().speak(speakStr)
|
|
responsed.add(interactionVO.id)
|
|
responsed.add(interactionVO.id)
|
|
@@ -1835,10 +1833,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
}
|
|
}
|
|
|
|
|
|
Constant.EVENT_END_CALL -> {
|
|
Constant.EVENT_END_CALL -> {
|
|
- if(broadcastOn){
|
|
|
|
- broadcastOn = false
|
|
|
|
- stopBroadcast(true)
|
|
|
|
- }
|
|
|
|
|
|
+ if (broadcastOn) {
|
|
|
|
+ broadcastOn = false
|
|
|
|
+ stopBroadcast(true)
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1850,7 +1848,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
timer_1_name = messageEvent.time_name_1
|
|
timer_1_name = messageEvent.time_name_1
|
|
main_time_tx_2.text = messageEvent.time_1
|
|
main_time_tx_2.text = messageEvent.time_1
|
|
val milliseconds = convertTimeToMilliseconds(messageEvent.time_1)
|
|
val milliseconds = convertTimeToMilliseconds(messageEvent.time_1)
|
|
- timer1_type= true
|
|
|
|
|
|
+ timer1_type = true
|
|
timer1 = object : CountDownTimer(milliseconds, 1000) {
|
|
timer1 = object : CountDownTimer(milliseconds, 1000) {
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
val seconds = (millisUntilFinished / 1000) % 60
|
|
val seconds = (millisUntilFinished / 1000) % 60
|
|
@@ -1863,9 +1861,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
override fun onFinish() {
|
|
override fun onFinish() {
|
|
main_time_tx_2.text = "00:00:00"
|
|
main_time_tx_2.text = "00:00:00"
|
|
data class MyObject(val title: String)
|
|
data class MyObject(val title: String)
|
|
- val myObject = MyObject(timer_1_name+"倒计时已结束")
|
|
|
|
|
|
+
|
|
|
|
+ val myObject = MyObject(timer_1_name + "倒计时已结束")
|
|
SOSHelper.sostime(myObject)
|
|
SOSHelper.sostime(myObject)
|
|
- timer1_type= false
|
|
|
|
|
|
+ timer1_type = false
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
main_time_ll.visibility = View.GONE
|
|
main_time_ll.visibility = View.GONE
|
|
}
|
|
}
|
|
@@ -1874,12 +1873,12 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
// Log.d("Timer3", "Finished!")
|
|
// Log.d("Timer3", "Finished!")
|
|
}
|
|
}
|
|
}.start()
|
|
}.start()
|
|
- }else{
|
|
|
|
- if (timer1!=null){
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if (timer1 != null) {
|
|
timer1?.cancel()
|
|
timer1?.cancel()
|
|
}
|
|
}
|
|
main_time_tx_2.text = "00:00:00"
|
|
main_time_tx_2.text = "00:00:00"
|
|
- timer1_type= false
|
|
|
|
|
|
+ timer1_type = false
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
main_time_ll.visibility = View.GONE
|
|
main_time_ll.visibility = View.GONE
|
|
}
|
|
}
|
|
@@ -1890,7 +1889,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
timer_2_name = messageEvent.time_name_2
|
|
timer_2_name = messageEvent.time_name_2
|
|
main_time_tx_4.text = messageEvent.time_2
|
|
main_time_tx_4.text = messageEvent.time_2
|
|
val milliseconds = convertTimeToMilliseconds(messageEvent.time_2)
|
|
val milliseconds = convertTimeToMilliseconds(messageEvent.time_2)
|
|
- timer2_type= true
|
|
|
|
|
|
+ timer2_type = true
|
|
timer2 = object : CountDownTimer(milliseconds, 1000) {
|
|
timer2 = object : CountDownTimer(milliseconds, 1000) {
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
val seconds = (millisUntilFinished / 1000) % 60
|
|
val seconds = (millisUntilFinished / 1000) % 60
|
|
@@ -1904,9 +1903,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
override fun onFinish() {
|
|
override fun onFinish() {
|
|
main_time_tx_4.text = "00:00:00"
|
|
main_time_tx_4.text = "00:00:00"
|
|
data class MyObject(val title: String)
|
|
data class MyObject(val title: String)
|
|
- val myObject = MyObject(timer_2_name+"倒计时已结束")
|
|
|
|
|
|
+
|
|
|
|
+ val myObject = MyObject(timer_2_name + "倒计时已结束")
|
|
SOSHelper.sostime(myObject)
|
|
SOSHelper.sostime(myObject)
|
|
- timer2_type= false
|
|
|
|
|
|
+ timer2_type = false
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
main_time_ll.visibility = View.GONE
|
|
main_time_ll.visibility = View.GONE
|
|
}
|
|
}
|
|
@@ -1914,12 +1914,12 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
// Log.d("Timer3", "Finished!")
|
|
// Log.d("Timer3", "Finished!")
|
|
}
|
|
}
|
|
}.start()
|
|
}.start()
|
|
- }else{
|
|
|
|
- if (timer2!=null){
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if (timer2 != null) {
|
|
timer2?.cancel()
|
|
timer2?.cancel()
|
|
}
|
|
}
|
|
main_time_tx_4.text = "00:00:00"
|
|
main_time_tx_4.text = "00:00:00"
|
|
- timer2_type= false
|
|
|
|
|
|
+ timer2_type = false
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
main_time_ll.visibility = View.GONE
|
|
main_time_ll.visibility = View.GONE
|
|
}
|
|
}
|
|
@@ -1930,7 +1930,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
timer_3_name = messageEvent.time_name_3
|
|
timer_3_name = messageEvent.time_name_3
|
|
main_time_tx_6.text = messageEvent.time_3
|
|
main_time_tx_6.text = messageEvent.time_3
|
|
val milliseconds = convertTimeToMilliseconds(messageEvent.time_3)
|
|
val milliseconds = convertTimeToMilliseconds(messageEvent.time_3)
|
|
- timer3_type= true
|
|
|
|
|
|
+ timer3_type = true
|
|
timer3 = object : CountDownTimer(milliseconds, 1000) {
|
|
timer3 = object : CountDownTimer(milliseconds, 1000) {
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
override fun onTick(millisUntilFinished: Long) {
|
|
val seconds = (millisUntilFinished / 1000) % 60
|
|
val seconds = (millisUntilFinished / 1000) % 60
|
|
@@ -1944,9 +1944,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
override fun onFinish() {
|
|
override fun onFinish() {
|
|
main_time_tx_6.text = "00:00:00"
|
|
main_time_tx_6.text = "00:00:00"
|
|
data class MyObject(val title: String)
|
|
data class MyObject(val title: String)
|
|
- val myObject = MyObject(timer_3_name+"倒计时已结束")
|
|
|
|
|
|
+
|
|
|
|
+ val myObject = MyObject(timer_3_name + "倒计时已结束")
|
|
SOSHelper.sostime(myObject)
|
|
SOSHelper.sostime(myObject)
|
|
- timer3_type= false
|
|
|
|
|
|
+ timer3_type = false
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
main_time_ll.visibility = View.GONE
|
|
main_time_ll.visibility = View.GONE
|
|
}
|
|
}
|
|
@@ -1954,12 +1955,12 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
// Log.d("Timer3", "Finished!")
|
|
// Log.d("Timer3", "Finished!")
|
|
}
|
|
}
|
|
}.start()
|
|
}.start()
|
|
- }else{
|
|
|
|
- if (timer3!=null){
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if (timer3 != null) {
|
|
timer3?.cancel()
|
|
timer3?.cancel()
|
|
}
|
|
}
|
|
main_time_tx_6.text = "00:00:00"
|
|
main_time_tx_6.text = "00:00:00"
|
|
- timer3_type= false
|
|
|
|
|
|
+ timer3_type = false
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
if (!timer1_type && !timer2_type && !timer3_type) {
|
|
main_time_ll.visibility = View.GONE
|
|
main_time_ll.visibility = View.GONE
|
|
}
|
|
}
|
|
@@ -2032,10 +2033,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
}
|
|
}
|
|
playing = true
|
|
playing = true
|
|
|
|
|
|
- if (SettingConfig.getSipEnabled(activity)) {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }else{
|
|
|
|
|
|
+ if (!SettingConfig.getSipEnabled(activity)) {
|
|
//初始化 engine
|
|
//初始化 engine
|
|
WebRTCEngine.getInstance().init(true, this)
|
|
WebRTCEngine.getInstance().init(true, this)
|
|
//初始化 janusClient
|
|
//初始化 janusClient
|
|
@@ -2095,7 +2093,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
|
|
* 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
|
|
* 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
|
|
* 仅对3128设备有效
|
|
* 仅对3128设备有效
|
|
*/
|
|
*/
|
|
- if (Build.MODEL.equals("rk3128")) {
|
|
|
|
|
|
+ if (Build.MODEL.equals("rk3128") || BuildConfig.flag == Constant.DEV_W_A133) {
|
|
Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP))
|
|
Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP))
|
|
var count = SettingConfig.getNetErrResetCount(this)
|
|
var count = SettingConfig.getNetErrResetCount(this)
|
|
if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
|
|
if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
|