Browse Source

1.卡尔主机和3128主机增加sip和webrtc通话功能,可在设置中手动切换,默认使用webrtc
2.左上角增加sip或webrtc字符,用于区分当前使用哪种模式

weizhengliang 2 years ago
parent
commit
a9549d9e93
16 changed files with 685 additions and 84 deletions
  1. 10 0
      android_host/src/main/common/java/com/wdkl/ncs/host/service/WdklSipService.java
  2. 7 0
      android_host/src/main/h10_wke_1h/AndroidManifest.xml
  3. 185 45
      android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt
  4. 292 0
      android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SipCallFragment.kt
  5. 33 4
      android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SystemSettingsFragment.kt
  6. 11 0
      android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/settingconfig/SettingConfig.java
  7. 31 8
      android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java
  8. 5 1
      android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/util/WarningDialogHelper.java
  9. 4 2
      android_host/src/main/h10_wke_1h/res/layout/activity_nurse_home.xml
  10. 56 4
      android_host/src/main/h10_wke_1h/res/layout/fragment_system_settings.xml
  11. 1 0
      android_host/src/main/h10_wke_1h/res/values/colors.xml
  12. 7 0
      android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt
  13. 11 9
      android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SystemSettingsFragment.kt
  14. 23 8
      android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java
  15. 5 1
      android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/WarningDialogHelper.java
  16. 4 2
      android_host/src/main/h10_z3128_1h/res/layout/activity_nurse_home.xml

+ 10 - 0
android_host/src/main/common/java/com/wdkl/ncs/host/service/WdklSipService.java

@@ -16,6 +16,8 @@ import android.util.Log;
 import android.widget.Toast;
 
 import com.wdkl.ncs.android.component.nursehome.R;
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig;
+import com.wdkl.ncs.android.lib.base.BaseApplication;
 import com.wdkl.ncs.android.middleware.common.Constants;
 import com.wdkl.ncs.android.middleware.utils.MessageEvent;
 import com.wdkl.ncs.host.activity.CallActivity;
@@ -114,6 +116,10 @@ public class WdklSipService extends Service {
         mCoreListener = new CoreListenerStub() {
             @Override
             public void onCallStateChanged(Core core, Call call, Call.State state, String message) {
+                if (!SettingConfig.getSipEnabled(BaseApplication.appContext)) {
+                    return;
+                }
+
                 Toast.makeText(WdklSipService.this, message, Toast.LENGTH_SHORT).show();
                 Log.d("sipCall", ">>>>>>>>>>>> call state: " + state + ", " + call.getRemoteAddress().asString());
 
@@ -138,6 +144,10 @@ public class WdklSipService extends Service {
 
             @Override
             public void onRegistrationStateChanged(Core core, ProxyConfig cfg, RegistrationState state, String message) {
+                if (!SettingConfig.getSipEnabled(BaseApplication.appContext)) {
+                    return;
+                }
+
                 EventBus.getDefault().post(new MessageEvent(state, Constants.EVENT_SIP_REGISTER_STATUS));
             }
         };

+ 7 - 0
android_host/src/main/h10_wke_1h/AndroidManifest.xml

@@ -105,6 +105,13 @@
             </intent-filter>
         </receiver>
 
+        <activity android:name="com.wdkl.ncs.host.activity.SipTestActivity" />
+        <activity android:name="com.wdkl.ncs.host.activity.CallActivity" />
+
+        <service
+            android:name="com.wdkl.ncs.host.service.WdklSipService"
+            android:label="@string/app_name" />
+
     </application>
 
 

+ 185 - 45
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt

@@ -67,6 +67,7 @@ import com.wdkl.ncs.android.middleware.udp.ServerInfoUtil
 import com.wdkl.ncs.android.middleware.utils.CommonUtils
 import com.wdkl.ncs.android.middleware.utils.MessageEvent
 import com.wdkl.ncs.android.middleware.utils.StringUtil
+import com.wdkl.ncs.host.service.WdklSipService
 import com.wdkl.ncs.janus.util.JanusConstant
 import io.reactivex.Observable
 import kotlinx.android.synthetic.main.activity_nurse_home.*
@@ -76,6 +77,9 @@ import org.freedesktop.gstreamer.GStreamer
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
+import org.linphone.core.AccountCreator
+import org.linphone.core.RegistrationState
+import org.linphone.core.TransportType
 import java.io.File
 import java.io.FileOutputStream
 import java.io.InputStream
@@ -112,6 +116,7 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
     var receiver :TimeReceiver? = null
     var batteryBroadcastReceiver: BatteryBroadcastReceiver? = null
 
+    private var mAccountCreator: AccountCreator? = null
 
     //呼叫对方设备id
     var callTargetId: Int? = -1
@@ -192,6 +197,20 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
     }
 
     private fun permissionGranted() {
+        if (SettingConfig.getSipEnabled(activity)) {
+            //启动sip服务
+            val serviceIntent = Intent(BaseApplication.appContext, WdklSipService::class.java)
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                //android8.0以上通过startForegroundService启动service
+                startForegroundService(serviceIntent)
+            } else {
+                startService(serviceIntent)
+            }
+            view_title_layout_tv_point.text = "sip"
+        } else {
+            view_title_layout_tv_point.text = "rtc"
+        }
+
         //显示设备信息
         Constants.mac = NetHelper.getInstance().macAddress
         Constants.imei = NetHelper.getInstance().imei
@@ -640,6 +659,10 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
             Constants.hospital_id = data.hospitalId
         }
 
+        if (data.sipIp != null) {
+            Constants.sip_ip = data.sipIp
+        }
+
         Constants.DEVICE_CODE = data.code
         Constants.DEVICE_MODEL =  data.model
         Constants.DEVICE_HARD_VER =  data.hardVer
@@ -1048,6 +1071,29 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
         Log.e(TAG,"收到返回的设置配置信息 ")
         Log.e(TAG,"partId "+data.partId)
 
+        if (SettingConfig.getSipEnabled(activity)) {
+            //配置sip账户
+            if (WdklSipService.getCore() != null) {
+                mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
+                // 以下三项必须
+                if (!TextUtils.isEmpty(Constants.sip_id) && !TextUtils.isEmpty(Constants.sip_ip)) {
+                    Log.e(TAG, "sip connect: ${Constants.sip_id} : ${Constants.sip_ip}")
+                    mAccountCreator!!.setDomain(Constants.sip_ip)
+                    mAccountCreator!!.setUsername(Constants.sip_id)
+                    mAccountCreator!!.setPassword(Constants.sip_id)
+                    //默认使用udp
+                    mAccountCreator!!.transport = TransportType.Udp
+
+                    // 这里会自动创建代理配置、认证信息到 SIP核心
+                    val cfg = mAccountCreator!!.createProxyConfig()
+                    // 确保新创建的是最新
+                    WdklSipService.getCore().defaultProxyConfig = cfg
+                } else {
+                    showMessage("SIP 数据不全")
+                }
+            }
+        }
+
         loadLedDevice()
 
         try {
@@ -1493,6 +1539,7 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
                 hookonTime = System.currentTimeMillis()
             } else if (intent.action == Constants.HOOK_OFF) {
                 Log.e(TAG,"手柄拿起 ")
+                EventBus.getDefault().post(MessageEvent(false, Constants.EVENT_TOGGLE_SPEAKER))
                 if (System.currentTimeMillis() - hookoffTime > 2000) {
                     Constants.hookOn = false
                     VoiceManagerUtil.switchAudioMode(activity, false)
@@ -1517,6 +1564,7 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
         Log.d(TAG, "keyDown ====> keyCode: $keyCode, action: ${event?.action}")
         if (keyCode == 135) {
             //手柄拿起
+            EventBus.getDefault().post(MessageEvent(false, Constants.EVENT_TOGGLE_SPEAKER))
             if (System.currentTimeMillis() - hookoffTime > 2000) {
                 Constants.hookOn = false
                 VoiceManagerUtil.switchAudioMode(activity, false)
@@ -1620,6 +1668,33 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
         }
     }
 
+    private fun updateSipState(state: RegistrationState) {
+        runOnUiThread {
+            when (state) {
+                RegistrationState.Ok -> {
+                    //连接完成
+                    view_title_layout_tv_point.setBackgroundResource(R.color.green)
+                }
+
+                RegistrationState.Failed -> {
+                    //连接错误
+                    view_title_layout_tv_point.setBackgroundResource(R.color.red_color)
+                }
+
+                RegistrationState.Progress -> {
+                    //正在连接
+                    view_title_layout_tv_point.setBackgroundResource(R.color.yellow_color)
+                }
+
+                RegistrationState.None, RegistrationState.Cleared -> {
+                    //默认状态,断开连接
+                    view_title_layout_tv_point.setBackgroundResource(R.color.register_text_color)
+                }
+            }
+            view_title_layout_tv_point.text = "sip"
+        }
+    }
+
     private fun updateNetState() {
         if (NetHelper.getInstance().networkType == ConnectivityManager.TYPE_WIFI) {
             wifi_state_imagev.visibility = View.VISIBLE
@@ -1642,10 +1717,16 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
     private fun updateTcpState() {
         if (Constants.tcp_connected) {
             tcp_state_imagev.setImageResource(R.drawable.ic_tcp_success)
-            view_title_layout_tv_point.setBackgroundResource(R.color.green)
+            if (!SettingConfig.getSipEnabled(activity)) {
+                view_title_layout_tv_point.text = "rtc"
+                view_title_layout_tv_point.setBackgroundResource(R.color.green)
+            }
         } else {
             tcp_state_imagev.setImageResource(R.drawable.ic_tcp_fail)
-            view_title_layout_tv_point.setBackgroundResource(R.color.red_color)
+            if (!SettingConfig.getSipEnabled(activity)) {
+                view_title_layout_tv_point.text = "rtc"
+                view_title_layout_tv_point.setBackgroundResource(R.color.red_color)
+            }
         }
     }
 
@@ -1679,6 +1760,15 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
     @Subscribe(threadMode = ThreadMode.MAIN)
     fun onMoonEvent(messageEvent: MessageEvent) {
         when (messageEvent.getType()) {
+            //Sip注册状态
+            Constants.EVENT_SIP_REGISTER_STATUS -> {
+                if (messageEvent.getMessage() is RegistrationState) {
+                    val state = messageEvent.getMessage() as RegistrationState
+                    Log.d(TAG, "sip register state: $state")
+                    updateSipState(state)
+                }
+            }
+
             //退出通话界面
             Constants.EVENT_REMOVE_CALL_FRAGMENT -> {
                 if (skyCallFragment != null) {
@@ -1749,28 +1839,54 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
                         Constants.CALL_STATE = Constants.CALL_OUTGOING
 
                         if (Constants.tcp_connected && !TextUtils.isEmpty(Constants.sip_id)) {
-                            //去电直接启动call fragment
-                            var fragment = SkyCallFragment()
-                            var bundle = Bundle()
-                            bundle.putBoolean("audio_only", Constants.call_type == 0)
-                            bundle.putInt("call_state", 0)
-                            bundle.putBoolean("visiting", false)
-                            //bundle.putString("targetId", targetId)
-                            if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
-                                || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
-                                || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType) {
-                                //医生机,护士主机,其他主机,总控主机等
-                                bundle.putString("call_name", interactionVO.toDeviceName)
-                            } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
-                                //移动设备
-                                bundle.putString("call_name", interactionVO.toMemberName)
+                            if (SettingConfig.getSipEnabled(activity)) {
+                                var fragment = SipCallFragment()
+                                var bundle = Bundle()
+                                bundle.putBoolean("audio_only", Constants.call_type == 0)
+                                bundle.putInt("call_state", 0)
+                                bundle.putBoolean("visiting", false)
+                                //bundle.putString("targetId", targetId)
+                                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                                    || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                                    || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                                ) {
+                                    //医生机,护士主机,其他主机,总控主机等
+                                    bundle.putString("call_name", interactionVO.toDeviceName)
+                                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                                    //移动设备
+                                    bundle.putString("call_name", interactionVO.toMemberName)
+                                } else {
+                                    //其他设备
+                                    bundle.putString("call_name", interactionVO.toFrameFullName)
+                                }
+                                bundle.putSerializable("interaction", interactionVO)
+                                fragment.arguments = bundle
+                                addCallFragment(fragment)
                             } else {
-                                //其他设备
-                                bundle.putString("call_name", interactionVO.toFrameFullName)
+                                //去电直接启动call fragment
+                                var fragment = SkyCallFragment()
+                                var bundle = Bundle()
+                                bundle.putBoolean("audio_only", Constants.call_type == 0)
+                                bundle.putInt("call_state", 0)
+                                bundle.putBoolean("visiting", false)
+                                //bundle.putString("targetId", targetId)
+                                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                                    || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                                    || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                                ) {
+                                    //医生机,护士主机,其他主机,总控主机等
+                                    bundle.putString("call_name", interactionVO.toDeviceName)
+                                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                                    //移动设备
+                                    bundle.putString("call_name", interactionVO.toMemberName)
+                                } else {
+                                    //其他设备
+                                    bundle.putString("call_name", interactionVO.toFrameFullName)
+                                }
+                                bundle.putSerializable("interaction", interactionVO)
+                                fragment.arguments = bundle
+                                addCallFragment(fragment)
                             }
-                            bundle.putSerializable("interaction", interactionVO)
-                            fragment.arguments = bundle
-                            addCallFragment(fragment)
                         } else {
                             showMessage(R.string.call_init_error)
                             Constants.CALL_STATE = Constants.CALL_STANDBY
@@ -2155,31 +2271,55 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
     private fun acceptCall(interactionVO: InteractionVO, audioOnly: Boolean) {
         //如果当前不是门禁请求界面才显示通话界面
         if (/*entraceGuardVideoFragment == null && */skyCallFragment == null) {
-            if (audioOnly) {
-                Constants.call_type = 0
-            } else {
-                Constants.call_type = 1
-            }
-            var fragment = SkyCallFragment()
-            var bundle = Bundle()
-            bundle.putInt("call_state", 1)
-            bundle.putBoolean("visiting", false)
-            bundle.putBoolean("audio_only", audioOnly)
-            if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
-                || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
-                || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType) {
-                //医生机,护士主机,其他主机,总控主机等
-                bundle.putString("call_name", interactionVO.fromDeviceName)
-            } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
-                //移动设备
-                bundle.putString("call_name", interactionVO.fromMemberName)
+            if (SettingConfig.getSipEnabled(activity)) {
+                var fragment = SipCallFragment()
+                var bundle = Bundle()
+                bundle.putInt("call_state", 1)
+                bundle.putBoolean("visiting", false)
+                bundle.putBoolean("audio_only", true)
+                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                    || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                    || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                ) {
+                    //医生机,护士主机,其他主机,总控主机等
+                    bundle.putString("call_name", interactionVO.fromDeviceName)
+                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                    //移动设备
+                    bundle.putString("call_name", interactionVO.fromMemberName)
+                } else {
+                    //其他设备
+                    bundle.putString("call_name", interactionVO.fromFrameFullName)
+                }
+                fragment.arguments = bundle
+                addCallFragment(fragment)
             } else {
-                //其他设备
-                bundle.putString("call_name", interactionVO.fromFrameFullName)
+                if (audioOnly) {
+                    Constants.call_type = 0
+                } else {
+                    Constants.call_type = 1
+                }
+                var fragment = SkyCallFragment()
+                var bundle = Bundle()
+                bundle.putInt("call_state", 1)
+                bundle.putBoolean("visiting", false)
+                bundle.putBoolean("audio_only", audioOnly)
+                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.toDeviceType
+                    || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.toDeviceType
+                    || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.toDeviceType
+                ) {
+                    //医生机,护士主机,其他主机,总控主机等
+                    bundle.putString("call_name", interactionVO.fromDeviceName)
+                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.toDeviceType) {
+                    //移动设备
+                    bundle.putString("call_name", interactionVO.fromMemberName)
+                } else {
+                    //其他设备
+                    bundle.putString("call_name", interactionVO.fromFrameFullName)
+                }
+                bundle.putSerializable("interaction", interactionVO)
+                fragment.arguments = bundle
+                addCallFragment(fragment)
             }
-            bundle.putSerializable("interaction", interactionVO)
-            fragment.arguments = bundle
-            addCallFragment(fragment)
         }
     }
 

+ 292 - 0
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SipCallFragment.kt

@@ -0,0 +1,292 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.os.CountDownTimer
+import android.os.Handler
+import android.os.Looper
+import android.os.SystemClock
+import android.text.TextUtils
+import android.util.Log
+import android.view.View
+import com.google.gson.Gson
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
+import com.wdkl.ncs.android.lib.base.BaseApplication
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.common.Constants
+import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration
+import com.wdkl.ncs.android.middleware.model.dos.InteractionDO
+import com.wdkl.ncs.android.middleware.tcp.channel.DeviceChannel
+import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
+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.TcpType
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import com.wdkl.ncs.host.service.WdklSipService
+import com.wdkl.ncs.host.util.AudioRouteUtils
+import kotlinx.android.synthetic.main.sky_voice_call_layout.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.linphone.core.Core
+
+class SipCallFragment: BaseCallFragment() {
+    private val TAG = "SipCallFragment"
+
+    private val handler = Handler(Looper.getMainLooper())
+
+    private var callEnded: Boolean = false
+
+    private var outGoing: Boolean = false
+
+    //呼叫倒计时
+    lateinit var countDownTimer: CountDownTimer
+
+
+    private var sipCore: Core? = null
+
+    override fun getLayId(): Int {
+        return R.layout.sky_voice_call_layout
+    }
+
+    override fun init() {
+        initCountDownTimer()
+
+        sipCore = WdklSipService.getCore()
+
+//        Log.d(TAG, "callState: $callState, local sip: ${Constants.sip_id}, target sip: ${Constants.targetSipId}")
+        when (callState) {
+            0 -> {
+                //发起通话
+                outGoing = true
+                showCallView(true)
+                Constants.CALL_STATE = Constants.CALL_OUTGOING
+                DeviceChannel.calling = true
+                RingPlayHelper.playRingTone(BaseApplication.appContext, R.raw.ring_back2, true)
+            }
+
+            1 -> {
+                //接受通话
+                outGoing = false
+                showCallView(false)
+                Constants.CALL_STATE = Constants.CALL_CALLING
+                DeviceChannel.calling = true
+            }
+        }
+    }
+
+    private fun initCountDownTimer() {
+        if (SettingConfiguration.getInstance().sipOvertime <= 0) {
+            SettingConfiguration.getInstance().sipOvertime = 30
+        }
+
+        countDownTimer = object: CountDownTimer(SettingConfiguration.getInstance().sipOvertime * 1000L, 1000) {
+            override fun onTick(millisUntilFinished: Long) {
+                //
+            }
+
+            override fun onFinish() {
+                //呼叫超时,退出呼叫界面
+                showMessage("无响应")
+                DeviceChannel.calling = false
+                Constants.CALL_STATE = Constants.CALL_STANDBY
+                VoiceUtil.cancelAudioCall(Constants.ids, Constants.targetDeviceId)
+                callEnd(false)
+            }
+        }
+    }
+
+    override fun bindEvent() {
+        //通话挂断
+        sky_voice_call_hangup.setOnClickListener {
+            if (Constants.CALL_STATE == Constants.CALL_CALLING) {
+                callEnd(true)
+            } else {
+                countDownTimer.cancel()
+                VoiceUtil.cancelAudioCall(Constants.ids, Constants.targetDeviceId)
+                callEnd(false)
+            }
+
+            Constants.CALL_STATE = Constants.CALL_STANDBY
+            DeviceChannel.calling = false
+        }
+    }
+
+    private fun callTerminate() {
+        if (sipCore != null && sipCore!!.callsNb > 0) {
+            var call = sipCore!!.currentCall
+            if (call == null) {
+                call = sipCore!!.calls[0]
+            }
+            call!!.terminate()
+        }
+    }
+
+    override fun destroy() {
+        RingPlayHelper.stopRingTone()
+        Constants.CALL_STATE = Constants.CALL_STANDBY
+        DeviceChannel.calling = false
+        if (sky_voice_call_timer != null) {
+            sky_voice_call_timer.stop()
+        }
+        handler.removeCallbacksAndMessages(null)
+    }
+
+    //开始接听
+    private fun showCallView(outgoing: Boolean) {
+        sky_call_name.text = callName
+        if (outgoing) {
+            countDownTimer.start()
+            sky_voice_call_calling_text.setText(R.string.call_in_calling)
+        } else {
+            sky_voice_call_calling_text.setText(R.string.call_connecting)
+        }
+        sky_voice_call_outgoing.visibility = View.VISIBLE
+        sky_voice_call_timer.visibility = View.GONE
+    }
+
+    private fun showCalling(audioOnly: Boolean) {
+        if (callEnded) {
+            return
+        }
+
+        if (Constants.hookOn) {
+            //免提
+            toggleSpeaker(true)
+        } else {
+            //听筒
+            toggleSpeaker(false)
+        }
+
+        if (audioOnly) {
+            ll_voice_call.visibility = View.VISIBLE
+        } else {
+            //显示视频画面
+            fullscreen_video_frame.visibility = View.VISIBLE
+            pip_video_frame.visibility = View.VISIBLE
+            ll_voice_call.visibility = View.GONE
+
+            if (visiting) {
+                visit_list_view.setVisibility(View.VISIBLE)
+            }
+        }
+
+        sky_voice_call_calling_text.setText(R.string.call_in_call)
+        sky_voice_call_timer.visibility = View.VISIBLE
+        sky_voice_call_timer.base = SystemClock.elapsedRealtime()
+        sky_voice_call_timer.start()
+    }
+
+    //通话结束
+    private fun callEnd(handoff: Boolean) {
+        Log.e(TAG, ">>>>>>>>>>> call end !!!!!!!!!!!!!!!!!!")
+        RingPlayHelper.stopRingTone()
+        countDownTimer.cancel()
+
+        synchronized(this) {
+            if (callEnded) {
+                return
+            }
+            callEnded = true
+
+            if (sky_voice_call_timer != null) {
+                sky_voice_call_timer.stop()
+            }
+
+            callTerminate()
+
+            Constants.CALL_STATE = Constants.CALL_STANDBY
+            DeviceChannel.calling = false
+            if (handoff) {
+                VoiceUtil.handoffAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
+            }
+
+            backToMain()
+        }
+    }
+
+    private fun toggleSpeaker(enable: Boolean) {
+        Log.d(TAG, "toggle speaker: $enable, sipCore: $sipCore")
+        if ( sipCore == null) {
+            return
+        }
+
+        if (enable) {
+            AudioRouteUtils.routeAudioToSpeaker(sipCore!!)
+        } else {
+            AudioRouteUtils.routeAudioToEarpiece(sipCore!!)
+        }
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        when (messageEvent.getType()) {
+            Constants.EVENT_TCP_MSG -> {
+                if (messageEvent.getMessage() is TcpModel) {
+                    val curTcpModel = messageEvent.getMessage() as TcpModel
+                    if (curTcpModel.type == TcpType.VOICE) {
+                        val curIt = Gson().fromJson(curTcpModel.data.toString(), InteractionDO::class.java)
+                        if (curTcpModel.action == TcpAction.VoiceAction.HANDOFF) {
+                            //对方挂断,不论我方呼出或呼入
+                            if (Constants.interactionId == curIt.id) {
+                                callEnd(false)
+                            }
+                        } else if (curTcpModel.action == TcpAction.VoiceAction.ACCEPT) {//对方接受语音
+                            RingPlayHelper.stopRingTone()
+                            sky_voice_call_calling_text.setText(R.string.call_connecting)
+                            Constants.interactionId = curIt.id
+                            Constants.fromId = curTcpModel.fromId
+                            DeviceChannel.calling = true
+                            Constants.CALL_STATE = Constants.CALL_CALLING
+                            countDownTimer.cancel()
+
+                            if (sipCore == null || TextUtils.isEmpty(curIt.toSipId)) {
+                                //通话失败,重置并返回主界面
+                                showMessage("Core或targetSipId为空!")
+                                Constants.CALL_STATE = Constants.CALL_STANDBY
+                                if (sky_voice_call_timer != null) {
+                                    sky_voice_call_timer.stop()
+                                }
+                                callEnd(true)
+                            } else {
+                                val addressToCall = sipCore!!.interpretUrl(curIt.toSipId)
+                                val params = sipCore!!.createCallParams(null)
+                                params?.isVideoEnabled = false
+                                if (addressToCall != null) {
+                                    sipCore!!.inviteAddressWithParams(addressToCall, params!!)
+                                    Log.d(TAG, ">>>>>>>>>>> invite address: " + addressToCall.asString())
+                                }
+                            }
+                        } else if (curTcpModel.action == TcpAction.VoiceAction.REJECT) {//对方拒绝
+                            if (Constants.interactionId == curIt.id) {
+                                showMessage("对方拒绝")
+                                Constants.CALL_STATE = Constants.CALL_STANDBY
+                                DeviceChannel.calling = false
+                                callEnd(false)
+                            }
+                        }
+                    }
+                }
+            }
+
+            Constants.EVENT_END_CALL -> {
+                Log.d(TAG, ">>>>>>>>>>>>>> EVENT_END_CALL")
+                if (messageEvent.getMessage() is String) {
+                    val str = messageEvent.getMessage() as String
+                    if (str.equals("cancel")) {
+                        callEnd(false)
+                    } else {
+                        callEnd(true)
+                    }
+                }
+            }
+
+            Constants.SIP_CONNECTED -> {
+                showCalling(true)
+            }
+
+            Constants.EVENT_TOGGLE_SPEAKER -> {
+                toggleSpeaker(false)
+            }
+        }
+    }
+
+}

+ 33 - 4
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SystemSettingsFragment.kt

@@ -18,6 +18,7 @@ import com.wdkl.ncs.android.component.nursehome.databinding.FragmentSystemSettin
 import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
 import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
 import com.wdkl.ncs.android.component.nursehome.util.*
+import com.wdkl.ncs.android.lib.base.BaseApplication
 import com.wdkl.ncs.android.lib.base.BaseFragment
 import com.wdkl.ncs.android.lib.utils.showMessage
 import com.wdkl.ncs.android.middleware.logic.contract.nursehome.SystemSettingsContract
@@ -25,6 +26,7 @@ import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.SystemSettingsP
 import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration
 import com.wdkl.ncs.android.middleware.model.dos.PartSettingDO
 import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import com.wdkl.ncs.host.activity.SipTestActivity
 import kotlinx.android.synthetic.main.fragment_system_settings.*
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -103,6 +105,12 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
             radio_record_off.isChecked = true
         }
 
+        if (SettingConfig.getSipEnabled(activity)) {
+            radio_sip_on.isChecked = true
+        } else {
+            radio_sip_off.isChecked = true
+        }
+
         //语音播报次数
         call_number_tv.text = SettingConfig.getCallNumber(this.activity).toString()
         call_number_seekb.setProgress((SettingConfig.getCallNumber(this.activity)))
@@ -263,6 +271,7 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
         system_settings_tv.setOnClickListener(this)
         language_settings_tv.setOnClickListener(this)
         restart_tv.setOnClickListener(this)
+        sip_test.setOnClickListener(this)
 
         originTime = SettingConfig.getCallStayTime(activity)
         spinner_call_stay_time.setSelection(originTime)
@@ -335,11 +344,11 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
             if (checkedId == R.id.radio_transfer_on) {
                 SettingConfiguration.getInstance().transferCall = true
                 SettingConfig.setTransferCall(activity, true)
-                WarningDialogHelper.showDialog(activity)
+                WarningDialogHelper.showDialog(activity, false)
             } else {
                 SettingConfiguration.getInstance().transferCall = false
                 SettingConfig.setTransferCall(activity, false)
-                WarningDialogHelper.showDialog(activity)
+                WarningDialogHelper.showDialog(activity, false)
             }
         }
 
@@ -369,7 +378,7 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
                 Log.d(TAG, "select pos: $position, origin: $originTime")
                 if (originTime != position) {
                     SettingConfig.setCallStayTime(activity, position)
-                    WarningDialogHelper.showDialog(activity)
+                    WarningDialogHelper.showDialog(activity, false)
                 }
             }
 
@@ -378,6 +387,18 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
             }
         }
 
+        group_sip.setOnCheckedChangeListener { group, checkedId ->
+            PasswordDialogHelper.showPasswordDialog(activity) {
+                if (checkedId == R.id.radio_sip_on) {
+                    SettingConfig.setSipEnable(activity, true)
+                } else {
+                    SettingConfig.setSipEnable(activity, false)
+                }
+
+                WarningDialogHelper.showDialog(activity, true)
+            }
+        }
+
         //播报次数加减
         call_number_decrease_tv.setOnClickListener(this)
         call_number_add_tv.setOnClickListener(this)
@@ -464,7 +485,15 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
 
             R.id.restart_tv -> {
                 PasswordDialogHelper.showPasswordDialog(activity) {
-                    AppUpdateHelper.restartApp(activity)
+                    AppUpdateHelper.restartApp(BaseApplication.appContext)
+                }
+            }
+
+            R.id.sip_test -> {
+                PasswordDialogHelper.showPasswordDialog(activity) {
+                    val intent = Intent()
+                    intent.setClass(context, SipTestActivity::class.java)
+                    startActivity(intent)
                 }
             }
         }

+ 11 - 0
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/settingconfig/SettingConfig.java

@@ -137,6 +137,9 @@ public class SettingConfig {
     private static final String KEY_LANGUAGE_ID = "KEY_LANGUAGE_ID";
     private static final String KEY_LANGUAGE_MODE = "KEY_LANGUAGE_MODE";
 
+    //是否使用sip通话
+    private static final String KEY_SP_SIP_ENABLE = "KEY_SP_SIP_ENABLE";
+
     public static boolean getRecordEnable(Context context) {
         return getSP(context).getBoolean(KEY_SP_RECORD_ENABLE, false);
     }
@@ -211,6 +214,14 @@ public class SettingConfig {
         getEditor(context).putInt(KEY_LANGUAGE_MODE, mode).apply();
     }
 
+    public static boolean getSipEnabled(Context context) {
+        return getSP(context).getBoolean(KEY_SP_SIP_ENABLE, false);
+    }
+
+    public static void setSipEnable(Context context, boolean enable) {
+        getEditor(context).putBoolean(KEY_SP_SIP_ENABLE, enable).apply();
+    }
+
 
     /**
      * 获取播报次数

+ 31 - 8
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java

@@ -14,6 +14,8 @@ import android.support.v4.content.FileProvider;
 import android.util.Log;
 
 import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity;
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig;
+import com.wdkl.ncs.host.service.WdklSipService;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -260,14 +262,29 @@ public class AppUpdateHelper {
     }
 
     public static void reboot(Context context) {
-        try {
-            Intent intent = new Intent(Intent.ACTION_REBOOT);
-            intent.putExtra("nowait", 1);
-            intent.putExtra("interval", 1);
-            intent.putExtra("window", 0);
-            context.sendBroadcast(intent);
-        } catch (Exception e) {
-            e.printStackTrace();
+        if (Build.MODEL.equals("rk3128")) {
+            try {
+                Intent intent = new Intent(Intent.ACTION_REBOOT);
+                intent.putExtra("nowait", 1);
+                intent.putExtra("interval", 1);
+                intent.putExtra("window", 0);
+                context.sendBroadcast(intent);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            Process process;
+            PrintWriter printWriter;
+            try {
+                process = Runtime.getRuntime().exec("su");
+                printWriter = new PrintWriter(process.getOutputStream());
+                printWriter.println("reboot");
+                printWriter.flush();
+                printWriter.close();
+                process.waitFor();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         }
     }
 
@@ -293,6 +310,12 @@ public class AppUpdateHelper {
     }
 
     public static void restartApp(Context context) {
+        if (SettingConfig.getSipEnabled(context)) {
+            //停止服务
+            Intent serviceIntent = new Intent(context, WdklSipService.class);
+            context.stopService(serviceIntent);
+        }
+
         //重新启动app
         Intent mStartActivity = new Intent(context.getApplicationContext(), NurseHomeActivity.class);
         mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

+ 5 - 1
android_host/src/main/h10_wke_1h/java/com/wdkl/ncs/android/component/nursehome/util/WarningDialogHelper.java

@@ -7,12 +7,13 @@ import android.view.View;
 import android.widget.Button;
 
 import com.wdkl.ncs.android.component.nursehome.R;
+import com.wdkl.ncs.android.lib.base.BaseApplication;
 
 
 public class WarningDialogHelper {
     private static AlertDialog dialog;
 
-    public static void showDialog(final Activity activity) {
+    public static void showDialog(final Activity activity, final boolean reboot) {
         if (dialog != null && dialog.isShowing()) {
             return;
         }
@@ -24,6 +25,9 @@ public class WarningDialogHelper {
         button.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                if (reboot) {
+                    AppUpdateHelper.reboot(BaseApplication.appContext);
+                }
                 AppUpdateHelper.restartApp(activity);
             }
         });

+ 4 - 2
android_host/src/main/h10_wke_1h/res/layout/activity_nurse_home.xml

@@ -13,10 +13,12 @@
                 <!--SIP状态图标-->
                 <TextView
                     android:id="@+id/view_title_layout_tv_point"
-                    android:layout_width="16dp"
-                    android:layout_height="16dp"
+                    android:layout_width="24dp"
+                    android:layout_height="24dp"
                     android:layout_centerVertical="true"
+                    android:gravity="center"
                     android:layout_marginLeft="10dp"
+                    android:textColor="@color/white"
                     android:background="@color/red_color"/>
 
                 <TextView

+ 56 - 4
android_host/src/main/h10_wke_1h/res/layout/fragment_system_settings.xml

@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
-<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:bind="http://schemas.android.com/apk/res-auto"
     xmlns:custom="http://schemas.android.com/apk/res-auto">
 
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="#87CEFA">
@@ -151,6 +152,44 @@
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_gravity="center_vertical"
+                            android:text="@string/setting_sip_enable"
+                            android:textColor="#000000"
+                            android:textSize="14px" />
+
+                        <RadioGroup
+                            android:id="@+id/group_sip"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:orientation="horizontal">
+
+                            <RadioButton
+                                android:id="@+id/radio_sip_on"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="@string/str_yes"
+                                android:textSize="14px" />
+
+                            <RadioButton
+                                android:id="@+id/radio_sip_off"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:text="@string/str_no"
+                                android:textSize="14px" />
+                        </RadioGroup>
+
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="2dp"
+                        android:layout_marginBottom="10px"
+                        android:orientation="horizontal">
+
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_vertical"
                             android:text="@string/setting_sos_call_name"
                             android:textColor="#000000"
                             android:textSize="14px" />
@@ -1428,10 +1467,10 @@
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_marginTop="20dp"
+                        android:background="@color/white"
+                        android:gravity="center"
                         android:paddingTop="10dp"
                         android:paddingBottom="10dp"
-                        android:gravity="center"
-                        android:background="@color/white"
                         android:text="@string/save_settings"
                         android:textColor="#000000"
                         android:textSize="18sp" />
@@ -1450,6 +1489,19 @@
                         android:textSize="18sp" />
 
                     <TextView
+                        android:id="@+id/sip_test"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="20dp"
+                        android:paddingTop="10dp"
+                        android:paddingBottom="10dp"
+                        android:gravity="center"
+                        android:background="@color/white"
+                        android:text="SIP test"
+                        android:textColor="#000000"
+                        android:textSize="18sp" />
+
+                    <TextView
                         android:id="@+id/software_and_information_tv"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"

+ 1 - 0
android_host/src/main/h10_wke_1h/res/values/colors.xml

@@ -15,4 +15,5 @@
     <color name="text_name_color">#B4B4B4</color>
 
     <color name="main_color">#2F9DF1</color>
+    <color name="register_text_color">#969696</color>
 </resources>

+ 7 - 0
android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt

@@ -173,6 +173,10 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
             } else {
                 startService(serviceIntent)
             }
+
+            view_title_layout_tv_point.text = "sip"
+        } else {
+            view_title_layout_tv_point.text = "rtc"
         }
 
         currentFragment = FramePartFragment()
@@ -1250,6 +1254,7 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
                     view_title_layout_tv_point.setBackgroundResource(R.color.register_text_color)
                 }
             }
+            view_title_layout_tv_point.text = "sip"
         }
     }
 
@@ -1257,11 +1262,13 @@ class NurseHomeActivity  : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
         if (Constants.tcp_connected) {
             tcp_state_imagev.setImageResource(R.drawable.ic_tcp_success)
             if (!SettingConfig.getSipEnabled(activity)) {
+                view_title_layout_tv_point.text = "rtc"
                 view_title_layout_tv_point.setBackgroundResource(R.color.green)
             }
         } else {
             tcp_state_imagev.setImageResource(R.drawable.ic_tcp_fail)
             if (!SettingConfig.getSipEnabled(activity)) {
+                view_title_layout_tv_point.text = "rtc"
                 view_title_layout_tv_point.setBackgroundResource(R.color.red_color)
             }
         }

+ 11 - 9
android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SystemSettingsFragment.kt

@@ -334,11 +334,11 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
             if (checkedId == R.id.radio_transfer_on) {
                 SettingConfiguration.getInstance().transferCall = true
                 SettingConfig.setTransferCall(activity, true)
-                WarningDialogHelper.showDialog(activity)
+                WarningDialogHelper.showDialog(activity, false)
             } else {
                 SettingConfiguration.getInstance().transferCall = false
                 SettingConfig.setTransferCall(activity, false)
-                WarningDialogHelper.showDialog(activity)
+                WarningDialogHelper.showDialog(activity, false)
             }
         }
 
@@ -360,7 +360,7 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
                 Log.d(TAG, "select pos: $position, origin: $originTime")
                 if (originTime != position) {
                     SettingConfig.setCallStayTime(activity, position)
-                    WarningDialogHelper.showDialog(activity)
+                    WarningDialogHelper.showDialog(activity, false)
                 }
             }
 
@@ -378,13 +378,15 @@ class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystem
         }
 
         group_sip.setOnCheckedChangeListener { group, checkedId ->
-            if (checkedId == R.id.radio_sip_on) {
-                SettingConfig.setSipEnable(activity, true)
-            } else {
-                SettingConfig.setSipEnable(activity, false)
-            }
+            PasswordDialogHelper.showPasswordDialog(activity) {
+                if (checkedId == R.id.radio_sip_on) {
+                    SettingConfig.setSipEnable(activity, true)
+                } else {
+                    SettingConfig.setSipEnable(activity, false)
+                }
 
-            WarningDialogHelper.showDialog(activity)
+                WarningDialogHelper.showDialog(activity, true)
+            }
         }
 
         //播报次数加减

+ 23 - 8
android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java

@@ -210,14 +210,29 @@ public class AppUpdateHelper {
     }
 
     public static void reboot(Context context) {
-        try {
-            Intent intent = new Intent(Intent.ACTION_REBOOT);
-            intent.putExtra("nowait", 1);
-            intent.putExtra("interval", 1);
-            intent.putExtra("window", 0);
-            context.sendBroadcast(intent);
-        } catch (Exception e) {
-            e.printStackTrace();
+        if (Build.MODEL.equals("rk3128")) {
+            try {
+                Intent intent = new Intent(Intent.ACTION_REBOOT);
+                intent.putExtra("nowait", 1);
+                intent.putExtra("interval", 1);
+                intent.putExtra("window", 0);
+                context.sendBroadcast(intent);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            Process process;
+            PrintWriter printWriter;
+            try {
+                process = Runtime.getRuntime().exec("su");
+                printWriter = new PrintWriter(process.getOutputStream());
+                printWriter.println("reboot");
+                printWriter.flush();
+                printWriter.close();
+                process.waitFor();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         }
     }
 

+ 5 - 1
android_host/src/main/h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/WarningDialogHelper.java

@@ -10,12 +10,13 @@ import android.view.WindowManager;
 import android.widget.Button;
 
 import com.wdkl.ncs.android.component.nursehome.R;
+import com.wdkl.ncs.android.lib.base.BaseApplication;
 
 
 public class WarningDialogHelper {
     private static AlertDialog dialog;
 
-    public static void showDialog(final Activity activity) {
+    public static void showDialog(final Activity activity, final boolean reboot) {
         if (dialog != null && dialog.isShowing()) {
             return;
         }
@@ -27,6 +28,9 @@ public class WarningDialogHelper {
         button.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
+                if (reboot) {
+                    AppUpdateHelper.reboot(BaseApplication.appContext);
+                }
                 AppUpdateHelper.restartApp(activity);
             }
         });

+ 4 - 2
android_host/src/main/h10_z3128_1h/res/layout/activity_nurse_home.xml

@@ -14,10 +14,12 @@
                 <!--SIP状态图标-->
                 <TextView
                     android:id="@+id/view_title_layout_tv_point"
-                    android:layout_width="16dp"
-                    android:layout_height="16dp"
+                    android:layout_width="24dp"
+                    android:layout_height="24dp"
                     android:layout_centerVertical="true"
                     android:layout_marginLeft="16dp"
+                    android:gravity="center"
+                    android:textColor="@color/white"
                     android:background="@color/red_color"/>
 
                 <TextView