Bladeren bron

祁阳分支:无服务器sip通话需求,调整界面显示

weizhengliang 1 jaar geleden
bovenliggende
commit
b06eccaab7
34 gewijzigde bestanden met toevoegingen van 1291 en 981 verwijderingen
  1. 4 0
      android_bed/src/main/h5_3128/AndroidManifest.xml
  2. 71 8
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt
  3. 28 6
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/adapter/NurseConfigAdpter.kt
  4. 1 1
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/BaseCallFragment.kt
  5. 103 78
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/MainFragment.kt
  6. 17 29
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/QrCodeFragment.kt
  7. 364 0
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/SipCallFragment.kt
  8. 2 1
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/helper/SerialPortHelper.java
  9. 0 581
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/sip/SipHelper.java.bak
  10. 250 0
      android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/sip/WdklSipService.java
  11. 11 10
      android_bed/src/main/h5_3128/res/layout/callingbed_main_lay.xml
  12. 11 19
      android_bed/src/main/h5_3128/res/layout/item_nurse_config.xml
  13. 96 106
      android_bed/src/main/h5_3128/res/layout/main_view.xml
  14. 2 2
      android_bed/src/main/h5_3128/res/layout/main_view_layout.xml
  15. 2 6
      android_bed/src/main/h5_3128/res/layout/qrcode_view.xml
  16. 118 0
      android_bed/src/main/h5_3128/res/layout/sip_voice_call_layout.xml
  17. 19 13
      android_bed/src/main/h5_3128/res/layout/view_bed_name.xml
  18. 58 0
      android_bed/src/main/h5_3128/res/layout/view_bed_name_home.xml
  19. 8 7
      android_bed/src/main/h5_3128/res/layout/view_title_layout.xml
  20. BIN
      android_bed/src/main/h5_3128/res/mipmap-hdpi/bg_main.png
  21. BIN
      android_bed/src/main/h5_3128/res/mipmap-mdpi/bg_main.png
  22. BIN
      android_bed/src/main/h5_3128/res/mipmap-xhdpi/bg_main.png
  23. 20 0
      android_bed/src/main/h5_3128/res/raw/linphonerc_default
  24. 34 0
      android_bed/src/main/h5_3128/res/raw/linphonerc_factory
  25. 1 1
      build.gradle
  26. 3 0
      common/build.gradle
  27. BIN
      common/libs/linphone-sdk-android-4.4.33.aar
  28. 1 1
      common/src/main/code/com/wdkl/ncs/android/lib/utils/EcodeHelper.kt
  29. 8 0
      middleware/src/main/code/com/wdkl/ncs/android/middleware/common/Constant.java
  30. 43 109
      middleware/src/main/code/com/wdkl/ncs/android/middleware/model/dos/PartSettingDO.java
  31. 1 1
      middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClientHandler.java
  32. 2 1
      middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/channel/DeviceUtil.java
  33. 11 0
      middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/dto/DeviceConnectDTO.java
  34. 2 1
      middleware/src/main/code/com/wdkl/ncs/android/middleware/utils/CommonUtils.java

+ 4 - 0
android_bed/src/main/h5_3128/AndroidManifest.xml

@@ -29,5 +29,9 @@
         <activity android:name=".activity.AppUpdateActivity"
             android:screenOrientation="landscape"
             android:launchMode="singleTask"/>
+
+        <service
+            android:name=".sip.WdklSipService"
+            android:label="@string/app_name" />
     </application>
 </manifest>

+ 71 - 8
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt

@@ -23,13 +23,14 @@ import com.enation.javashop.net.engine.model.NetState
 import com.google.gson.Gson
 import com.wdkl.app.ncs.callingbed.BuildConfig
 import com.wdkl.app.ncs.callingbed.R
-import com.wdkl.app.ncs.callingbed.adapter.NurseConfigAdpter
+import com.wdkl.app.ncs.callingbed.adapter.NurseConfigAdapter
 import com.wdkl.app.ncs.callingbed.agreement.CallingbedAgreement
 import com.wdkl.app.ncs.callingbed.databinding.CallingbedMainLayBinding
 import com.wdkl.app.ncs.callingbed.fragment.*
 import com.wdkl.app.ncs.callingbed.helper.*
 import com.wdkl.app.ncs.callingbed.launch.CallingbedLaunch
 import com.wdkl.app.ncs.callingbed.settings.SettingConfig
+import com.wdkl.app.ncs.callingbed.sip.WdklSipService
 import com.wdkl.ncs.android.lib.base.BaseActivity
 import com.wdkl.ncs.android.lib.base.BaseApplication
 import com.wdkl.ncs.android.lib.utils.AppTool
@@ -74,6 +75,9 @@ import okhttp3.Request
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
+import org.linphone.core.AccountCreator
+import org.linphone.core.Factory
+import org.linphone.core.TransportType
 import serialporttest.utils.SerialPortUtil
 import java.io.*
 import java.lang.Process
@@ -105,7 +109,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
     private var backTimeout = 0
 
     private lateinit var linearLayout : LinearLayoutManager
-    private lateinit var nurseConfigAdpter : NurseConfigAdpter
+    private lateinit var nurseConfigAdpter : NurseConfigAdapter
     private var configList = ArrayList<NurseConfigDto>()
     private var sipServiceRunning :Boolean = false
     private var initialized :Boolean = false
@@ -116,6 +120,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
 
     //通话界面fragment
     private var skyCallFragment: Fragment? = null
+    private var mAccountCreator: AccountCreator? = null
 
     //网络异常计数
     private var netErrCount : Int = 0
@@ -199,6 +204,10 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
     override fun init() {
         //获取mac地址
         Constant.LOCAL_MAC = NetHelper.getInstance().macAddress
+        Constant.LOCAL_IP = NetHelper.getInstance().localIP
+
+        //启动sip服务
+        startService(Intent().setClass(this, WdklSipService::class.java))
 
         //注册广播
         regReceiver()
@@ -508,7 +517,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
     private fun initNurseConfig() {
         //初始化默认护理项
         for (index in 1..5) {
-            var item = NurseConfigDto()
+            val item = NurseConfigDto()
             item.nurseConfigName = StringUtil.getResString(R.string.default_nurse_config_name)
             item.nurseOptionName = StringUtil.getResString(R.string.str_empty)
             item.nurseColorRbg = ""
@@ -516,7 +525,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
         }
 
         linearLayout = LinearLayoutManager(activity)
-        nurseConfigAdpter = NurseConfigAdpter(activity, configList)
+        nurseConfigAdpter = NurseConfigAdapter(activity, configList)
         rv_left_list.layoutManager = linearLayout
         rv_left_list.adapter = nurseConfigAdpter
     }
@@ -665,6 +674,13 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
             Constant.DEVICE_STATUS = deviceInfo.status
         }
 
+        if (deviceInfo.partName != null) {
+            Constant.PART_NAME = deviceInfo.partName
+        }
+        if (deviceInfo.part_union_id != null) {
+            Constant.PART_UNION_ID = deviceInfo.part_union_id
+        }
+
         initialized = true
         view_title_layout_tv_hospital_name.text = deviceInfo.partDisplay
         view_title_layout_tv_no.text = "ID:" + deviceInfo.id
@@ -699,6 +715,45 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
 
     override fun setPartSettings(partSetting: PartSettingDO) {
         try {
+            //配置sip账户
+            if (WdklSipService.getCore() != null) {
+                /*mAccountCreator = WdklSipService.getCore().createAccountCreator(null)
+                // 以下三项必须
+                if (!TextUtils.isEmpty(Constant.TCP_SERVER_URL) && !TextUtils.isEmpty(Constant.SIP_ID)) {
+                    Log.e(TAG, "sip connect: ${Constant.SIP_ID}")
+                    mAccountCreator!!.setDomain(Constant.TCP_SERVER_URL)
+                    mAccountCreator!!.setUsername(Constant.SIP_ID)
+                    mAccountCreator!!.setPassword(Constant.SIP_ID)
+                    //默认使用udp
+                    mAccountCreator!!.transport = TransportType.Udp
+
+                    // 这里会自动创建代理配置、认证信息到 SIP核心
+                    val cfg = mAccountCreator!!.createProxyConfig()
+                    // 确保新创建的是最新
+                    WdklSipService.getCore().defaultProxyConfig = cfg
+                }*/
+
+
+                WdklSipService.getCore().clearAllAuthInfo()
+                WdklSipService.getCore().clearProxyConfig()
+                //无服务器时端口必须,固定5060,否则拨打IP时,也需加上端口号。如:sip:192.168.1.100:6666
+                val transports = Factory.instance().createTransports()
+                transports.setUdpPort(5060)
+                transports.setTcpPort(5060)
+                WdklSipService.getCore().setTransports(transports)
+
+                if (!TextUtils.isEmpty(Constant.SIP_ID) && !TextUtils.isEmpty(Constant.LOCAL_IP)) {
+                    val accountCreator = WdklSipService.getCore().createAccountCreator(null)
+                    accountCreator.setUsername(Constant.SIP_ID)
+                    accountCreator.setDomain(Constant.LOCAL_IP)
+                    accountCreator.setTransport(TransportType.Udp)
+                    val cfg = accountCreator.createProxyConfig()
+                    WdklSipService.getCore().setDefaultProxyConfig(cfg)
+                } else {
+                    showMessage("没有IP地址或没有SIP ID")
+                }
+            }
+
             //设置白昼起止时间
             SettingConfig.setInitialDayTime(this, partSetting.dayStart.substring(0,5))
             SettingConfig.setEndOfDay(this,partSetting.nightStart.substring(0,5))
@@ -730,6 +785,14 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
                 Constant.nurseValid = partSetting.nurseValid
             }
 
+            if (partSetting.convenientServiceEnabled != null) {
+                Constant.convenientServiceEnabled = partSetting.convenientServiceEnabled
+            }
+
+            if (partSetting.boolDisplayNcTitle != null) {
+                Constant.boolDisplayNcTitle = partSetting.boolDisplayNcTitle
+            }
+
             if (partSetting.autoAccept != null && partSetting.autoAccept == 1) {
                 SettingConfig.setAutoAnswer(activity, true)
             } else {
@@ -1327,7 +1390,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
                 //去电界面
                 Constant.CALL_TYPE = type
                 Constant.CALL_STATE = Constant.CALL_OUTGOING
-                var fragment = SkyCallFragment()
+                var fragment = SipCallFragment()
                 var bundle = Bundle()
                 bundle.putInt("call_state", 0)
                 bundle.putBoolean("bc_play", false)
@@ -1424,7 +1487,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
                                     }
 
                                     //来电界面
-                                    var fragment = SkyCallFragment()
+                                    var fragment = SipCallFragment()
                                     var bundle = Bundle()
                                     bundle.putInt("call_state", 1)
                                     bundle.putSerializable("tcp_model", tcpModel)
@@ -1664,9 +1727,9 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, CallingbedMa
         if (Build.MODEL.equals("rk3128")) {
             var count = SettingConfig.getNetErrResetCount(this)
             Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount
-                    + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP)
+                    + ", IP isEmpty: " + TextUtils.isEmpty(Constant.LOCAL_IP)
                     + ", net error count: " + count)
-            if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
+            if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(Constant.LOCAL_IP)) {
                 netErrCount++
             } else {
                 netErrCount = 0

+ 28 - 6
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/adapter/NurseConfigAdpter.kt

@@ -4,17 +4,18 @@ import android.content.Context
 import android.graphics.Color
 import android.support.v7.widget.RecyclerView
 import android.text.TextUtils
+import android.view.Gravity
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import android.widget.LinearLayout
 import android.widget.TextView
 import com.wdkl.app.ncs.callingbed.R
+import com.wdkl.ncs.android.middleware.common.Constant
 import com.wdkl.ncs.android.middleware.model.dto.NurseConfigDto
-import com.wdkl.ncs.android.middleware.utils.StringUtil
 import java.lang.Exception
 
-class NurseConfigAdpter : RecyclerView.Adapter<NurseConfigAdpter.ViewHolder> {
+class NurseConfigAdapter : RecyclerView.Adapter<NurseConfigAdapter.ViewHolder> {
     private var context: Context
     private var data: ArrayList<NurseConfigDto>
 
@@ -32,14 +33,35 @@ class NurseConfigAdpter : RecyclerView.Adapter<NurseConfigAdpter.ViewHolder> {
 
     override fun onBindViewHolder(holder: ViewHolder, position: Int) {
         try {
-            val color = data[position].nurseColorRbg
-            if (StringUtil.notEmpty(color)) {
-                holder.nurseItem.setBackgroundColor(Color.parseColor("#$color"))
+            if (Constant.boolDisplayNcTitle == 0) {
+                holder.nurseName.visibility = View.GONE
+                holder.nurseValue.textSize = 32f
+                holder.nurseValue.gravity = Gravity.CENTER_VERTICAL or Gravity.LEFT
+                //holder.nurseValue.setSingleLine(false)
+                //holder.nurseValue.setFocusable(false)
+                //holder.nurseValue.setFocusableInTouchMode(false)
+                //holder.nurseValue.marqueeRepeatLimit = -1
             } else {
-                holder.nurseItem.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                holder.nurseName.visibility = View.VISIBLE
+                holder.nurseValue.setTextSize(28f)
+                holder.nurseValue.gravity = Gravity.CENTER_VERTICAL or Gravity.RIGHT
+                //holder.nurseValue.setSingleLine(true)
+                //holder.nurseValue.setFocusable(true)
+                //holder.nurseValue.setFocusableInTouchMode(true)
             }
             holder.nurseName.setText(data.get(position).nurseConfigName)
             holder.nurseValue.setText(data.get(position).nurseOptionName)
+
+            val color = data[position].nurseColorRbg
+            if (TextUtils.isEmpty(data.get(position).nurseOptionName)) {
+                holder.nurseItem.setBackgroundColor(Color.parseColor("#E7E7E7"))
+            } else {
+                if (TextUtils.isEmpty(color)) {
+                    holder.nurseItem.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                } else {
+                    holder.nurseItem.setBackgroundColor(Color.parseColor("#$color"))
+                }
+            }
         } catch (e: Exception) {
             e.printStackTrace()
         }

+ 1 - 1
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/BaseCallFragment.kt

@@ -89,7 +89,7 @@ abstract class BaseCallFragment: Fragment() {
 
     //初始化计时器
     protected fun initCountDownTimer(view: TextView) {
-        var overTime = SettingConfig.getSipOverTime(baseActivity) * 5 * 1000L
+        var overTime = SettingConfig.getSipOverTime(baseActivity) * 10 * 1000L
         if (overTime <= 0) {
             overTime = 30000L
         }

+ 103 - 78
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/MainFragment.kt

@@ -1,6 +1,5 @@
 package com.wdkl.app.ncs.callingbed.fragment
 
-import android.content.Intent
 import android.graphics.Color
 import android.text.TextUtils
 import android.util.Log
@@ -10,7 +9,6 @@ import com.wdkl.app.ncs.callingbed.BuildConfig
 import com.wdkl.app.ncs.callingbed.R
 import com.wdkl.app.ncs.callingbed.activity.CallingbedActivity
 import com.wdkl.app.ncs.callingbed.databinding.MainViewLayoutBinding
-import com.wdkl.app.ncs.callingbed.helper.SerialPortHelper
 import com.wdkl.app.ncs.callingbed.launch.CallingbedLaunch
 import com.wdkl.ncs.android.lib.base.BaseFragment
 import com.wdkl.ncs.android.lib.utils.*
@@ -24,7 +22,7 @@ import com.wdkl.ncs.android.middleware.model.dto.NurseConfigDto
 import com.wdkl.ncs.android.middleware.model.vo.CustomerInfoVO
 import com.wdkl.ncs.android.middleware.utils.StringUtil
 import kotlinx.android.synthetic.main.main_view.*
-import kotlinx.android.synthetic.main.view_bed_name.*
+import kotlinx.android.synthetic.main.view_bed_name_home.*
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -32,6 +30,8 @@ import org.greenrobot.eventbus.ThreadMode
 class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>(), MainFragmentContract.View{
     val TAG = "MainFragment"
 
+    val QR_CODE_URL2 = "http://n.szwdkl.cn?type=BIND_PART_AND_ADDR"
+
     override fun getLayId(): Int {
         return R.layout.main_view
     }
@@ -45,7 +45,7 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
     }
 
     override fun bindEvent() {
-        //
+        //debugLog(TAG,"bindEvent")
     }
 
     override fun onStart() {
@@ -59,7 +59,7 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
     }
 
     override fun destory() {
-        //
+        //debugLog(TAG,"destory")
     }
 
     override fun showCustomInfo(customInfo: CustomerInfoVO) {
@@ -70,36 +70,19 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
         //显示入住信息
         tv_custom_name.text = customInfo.named
         if (customInfo.sex == 0) {
-            tv_custom_gender.setBackgroundResource(R.mipmap.ic_gender_female)
+            //tv_custom_gender.setBackgroundResource(R.mipmap.ic_gender_female)
+            tv_custom_gender.setText("女")
         } else if (customInfo.sex == 1) {
-            tv_custom_gender.setBackgroundResource(R.mipmap.ic_gender_male)
+            //tv_custom_gender.setBackgroundResource(R.mipmap.ic_gender_male)
+            tv_custom_gender.setText("男")
         }
         tv_custom_age.text = "" + customInfo.age + customInfo.ageUnit
         if (customInfo.inDate != null) {
-            tv_custom_indate.text = StringUtil.getResString(R.string.indate) + TimeHandle.getDateTime(customInfo.inDate * 1000, "yyyy.MM.dd")
+            tv_custom_indate.text = "入院日期: " + TimeHandle.getDateTime(customInfo.inDate * 1000, "yyyy.MM.dd")
         }
         if (!TextUtils.isEmpty(customInfo.cardNo)) {
             tv_custom_card_no.text = StringUtil.getResString(R.string.card_no) + customInfo.cardNo
         }
-        if (TextUtils.isEmpty(customInfo.advice)) {
-            tv_order_content.text = StringUtil.getResString(R.string.str_empty)
-        } else {
-            tv_order_content.text = customInfo.advice
-        }
-
-        if (Constant.doctorValid == 1) {
-            ll_doctor_view.visibility = View.VISIBLE
-            tv_doctor_title.text = Constant.doctorTitle
-        } else {
-            ll_doctor_view.visibility = View.GONE
-        }
-
-        if (Constant.nurseValid == 1) {
-            ll_nurse_view.visibility = View.VISIBLE
-            tv_nurse_title.text = Constant.nurseTitle
-        } else {
-            ll_nurse_view.visibility = View.GONE
-        }
 
         tv_doctor_name.text = customInfo.doctorName
         tv_nurse_name.text = customInfo.nurseName
@@ -111,8 +94,32 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
                     (activity as CallingbedActivity).updateNurseConfig(customInfo.list)
                 }
             }
+            //updateMoreConfigs(customInfo.list)
+        }
 
-            updateMoreConfigs(customInfo.list)
+        if (Constant.convenientServiceEnabled) {
+            main_view_qr_code?.visibility = View.VISIBLE
+            tv_qr_code_title?.visibility = View.VISIBLE
+        } else {
+            main_view_qr_code?.visibility = View.GONE
+            tv_qr_code_title?.visibility = View.GONE
+        }
+
+        if (Constant.DEVICE_STATUS == 1 && Constant.CUSTOM_ID != -1) {
+            Thread {
+                var builder = StringBuilder()
+                builder.append(QR_CODE_URL2)
+                builder.append("&no=")
+                builder.append(Constant.PART_UNION_ID)
+                builder.append("&page=shopping")
+                builder.append("&addr=")
+                builder.append(Constant.PART_NAME)
+                builder.append(Constant.BED_NAME)
+                val code = EcodeHelper().createQRImage(builder.toString(), 180, null)
+                activity.runOnUiThread {
+                    main_view_qr_code?.setImageBitmap(code)
+                }
+            }.start()
         }
     }
 
@@ -121,6 +128,7 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
     }
 
     override fun onError(message: String, type: Int) {
+        //errorLog("error",message)
         showMessage(message)
     }
 
@@ -143,16 +151,16 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
     }
 
     override fun onNoNet() {
-        showMessage("No network")
+        showMessage("没有网络")
     }
 
-    private fun updateInfo() {
+    fun updateInfo() {
         if (Constant.DEVICE_STATUS == 0) {
-            tv_bed_name.text = StringUtil.getResString(R.string.device_disable)
-            tv_bed_name.setTextColor(resources.getColor(R.color.red_color))
+            tv_home_bed_name.text = "设备未启用"
+            tv_home_bed_name.setTextColor(resources.getColor(R.color.red_color))
         } else {
-            tv_bed_name.text = Constant.BED_NAME
-            tv_bed_name.setTextColor(resources.getColor(R.color.main_color))
+            tv_home_bed_name.text = Constant.BED_NAME
+            tv_home_bed_name.setTextColor(resources.getColor(R.color.black))
         }
 
         if (Constant.CUSTOM_ID != -1) {
@@ -160,55 +168,72 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
             presenter.loadCustomInfo(Constant.CUSTOM_ID)
         }
 
-        tv_version.text = "V"+BuildConfig.VERSION_NAME+"_"+BuildConfig.VERSION_CODE
+        tv_home_version.text = "V"+BuildConfig.VERSION_NAME+"_"+BuildConfig.VERSION_CODE
     }
 
     private fun updateMoreConfigs(data: List<NurseConfigDto>) {
-        try {
-            if (data.size > 5) {
-                ll_nurse_more.visibility = View.VISIBLE
-                if (data.size == 6) {
-                    if (StringUtil.notEmpty(data[5].nurseColorRbg)) {
-                        ll_nurse_item6.setBackgroundColor(Color.parseColor("#" + data[5].nurseColorRbg))
-                    }
-                    tv_nurse_name6.text = data[5].nurseConfigName
-                    tv_nurse_value6.text = data[5].nurseOptionName
-                } else if (data.size == 7) {
-                    if (StringUtil.notEmpty(data[5].nurseColorRbg)) {
-                        ll_nurse_item6.setBackgroundColor(Color.parseColor("#" + data[5].nurseColorRbg))
-                    }
-                    tv_nurse_name6.text = data[5].nurseConfigName
-                    tv_nurse_value6.text = data[5].nurseOptionName
-
-                    if (StringUtil.notEmpty(data[6].nurseColorRbg)) {
-                        ll_nurse_item7.setBackgroundColor(Color.parseColor("#" + data[6].nurseColorRbg))
-                    }
-                    tv_nurse_name7.text = data[6].nurseConfigName
-                    tv_nurse_value7.text = data[6].nurseOptionName
-                } else if (data.size >= 8) {
-                    if (StringUtil.notEmpty(data[5].nurseColorRbg)) {
-                        ll_nurse_item6.setBackgroundColor(Color.parseColor("#" + data[5].nurseColorRbg))
-                    }
-                    tv_nurse_name6.text = data[5].nurseConfigName
-                    tv_nurse_value6.text = data[5].nurseOptionName
-
-                    if (StringUtil.notEmpty(data[6].nurseColorRbg)) {
-                        ll_nurse_item7.setBackgroundColor(Color.parseColor("#" + data[6].nurseColorRbg))
-                    }
-                    tv_nurse_name7.text = data[6].nurseConfigName
-                    tv_nurse_value7.text = data[6].nurseOptionName
-
-                    if (StringUtil.notEmpty(data[7].nurseColorRbg)) {
-                        ll_nurse_item8.setBackgroundColor(Color.parseColor("#" + data[7].nurseColorRbg))
-                    }
-                    tv_nurse_name8.text = data[7].nurseConfigName
-                    tv_nurse_value8.text = data[7].nurseOptionName
+        if (data.size > 5) {
+            ll_nurse_more.visibility = View.VISIBLE
+            if (data.size == 6) {
+                tv_nurse_name6.text = data[5].nurseConfigName
+                tv_nurse_value6.text = data[5].nurseOptionName
+
+                val color5 = data[5].nurseColorRbg
+                if (TextUtils.isEmpty(color5)) {
+                    ll_nurse_item6.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                } else {
+                    ll_nurse_item6.setBackgroundColor(Color.parseColor("#$color5"))
+                }
+            } else if (data.size == 7) {
+                tv_nurse_name6.text = data[5].nurseConfigName
+                tv_nurse_value6.text = data[5].nurseOptionName
+                tv_nurse_name7.text = data[6].nurseConfigName
+                tv_nurse_value7.text = data[6].nurseOptionName
+
+                val color5 = data[5].nurseColorRbg
+                if (TextUtils.isEmpty(color5)) {
+                    ll_nurse_item6.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                } else {
+                    ll_nurse_item6.setBackgroundColor(Color.parseColor("#$color5"))
+                }
+
+                val color6 = data[6].nurseColorRbg
+                if (TextUtils.isEmpty(color6)) {
+                    ll_nurse_item7.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                } else {
+                    ll_nurse_item7.setBackgroundColor(Color.parseColor("#$color6"))
+                }
+            } else if (data.size >= 8) {
+                tv_nurse_name6.text = data[5].nurseConfigName
+                tv_nurse_value6.text = data[5].nurseOptionName
+                tv_nurse_name7.text = data[6].nurseConfigName
+                tv_nurse_value7.text = data[6].nurseOptionName
+                tv_nurse_name8.text = data[7].nurseConfigName
+                tv_nurse_value8.text = data[7].nurseOptionName
+
+                val color5 = data[5].nurseColorRbg
+                if (TextUtils.isEmpty(color5)) {
+                    ll_nurse_item6.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                } else {
+                    ll_nurse_item6.setBackgroundColor(Color.parseColor("#$color5"))
+                }
+
+                val color6 = data[6].nurseColorRbg
+                if (TextUtils.isEmpty(color6)) {
+                    ll_nurse_item7.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                } else {
+                    ll_nurse_item7.setBackgroundColor(Color.parseColor("#$color6"))
+                }
+
+                val color7 = data[7].nurseColorRbg
+                if (TextUtils.isEmpty(color7)) {
+                    ll_nurse_item8.setBackgroundColor(Color.parseColor("#E7E7E7"))
+                } else {
+                    ll_nurse_item8.setBackgroundColor(Color.parseColor("#$color7"))
                 }
-            } else {
-                ll_nurse_more.visibility = View.GONE
             }
-        } catch (e: Exception) {
-            e.printStackTrace()
+        } else {
+            ll_nurse_more.visibility = View.GONE
         }
     }
 

+ 17 - 29
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/QrCodeFragment.kt

@@ -1,23 +1,25 @@
 package com.wdkl.app.ncs.callingbed.fragment
 
+import android.graphics.BitmapFactory
 import com.enation.javashop.net.engine.model.NetState
 import com.wdkl.app.ncs.callingbed.BuildConfig
 import com.wdkl.app.ncs.callingbed.R
 import com.wdkl.app.ncs.callingbed.activity.CallingbedActivity
 import com.wdkl.app.ncs.callingbed.databinding.QrcodeViewBinding
 import com.wdkl.app.ncs.callingbed.helper.AppUpdateHelper
-import com.wdkl.app.ncs.callingbed.helper.LanguageSetDialogHelper
 import com.wdkl.app.ncs.callingbed.helper.NetHelper
 import com.wdkl.app.ncs.callingbed.helper.ServerConfigDialogHelper
 import com.wdkl.app.ncs.callingbed.launch.CallingbedLaunch
 import com.wdkl.ncs.android.lib.base.BaseFragment
 import com.wdkl.ncs.android.lib.utils.EcodeHelper
+import com.wdkl.ncs.android.lib.utils.debugLog
+import com.wdkl.ncs.android.lib.utils.errorLog
+import com.wdkl.ncs.android.lib.utils.showMessage
 import com.wdkl.ncs.android.lib.vo.filter
 import com.wdkl.ncs.android.middleware.api.UrlManager
 import com.wdkl.ncs.android.middleware.common.Constant
 import com.wdkl.ncs.android.middleware.logic.contract.callingbed.QrCodeFragmentContract
 import com.wdkl.ncs.android.middleware.logic.presenter.callingbed.QrCodeFragmentPresenter
-import com.wdkl.ncs.android.middleware.utils.StringUtil
 import kotlinx.android.synthetic.main.qrcode_view.*
 import kotlinx.android.synthetic.main.view_bed_name.*
 
@@ -35,11 +37,11 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrcodeViewBinding>(
 
     override fun init() {
         if (Constant.DEVICE_STATUS == 0) {
-            tv_bed_name.text = StringUtil.getResString(R.string.device_disable)
+            tv_bed_name.text = "设备未启用"
             tv_bed_name.setTextColor(resources.getColor(R.color.red_color))
         } else {
             tv_bed_name.text = Constant.BED_NAME
-            tv_bed_name.setTextColor(resources.getColor(R.color.main_color))
+            tv_bed_name.setTextColor(resources.getColor(R.color.black))
         }
 
         tv_version.text = "V"+BuildConfig.VERSION_NAME+"_"+BuildConfig.VERSION_CODE
@@ -62,35 +64,29 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrcodeViewBinding>(
             builder.append(Constant.DEVICE_TYPE)
             builder.append("&device_name=")
             builder.append(Constant.DEVICE_NAME)
-            val code = EcodeHelper().createQRImage(builder.toString(),180, null)
+            val code = EcodeHelper().createQRImage(builder.toString(),160, null)
             activity.runOnUiThread {
-                if (view_qr_code != null) {
-                    view_qr_code?.setImageBitmap(code)
-                }
+                view_qr_code?.setImageBitmap(code)
             }
         }.start()
 
-        val macAddr = NetHelper.getInstance().macAddress
-        val ipAddr = NetHelper.getInstance().localIP
         if (Constant.DEVICE_STATUS == 0) {
-            tv_device_id.text = "Device ID: " + Constant.DEVICE_ID + " - " + StringUtil.getResString(R.string.str_disable)
+            tv_device_id.text = "设备ID: " + Constant.DEVICE_ID + " - 未启用"
         } else if (Constant.DEVICE_STATUS == 1) {
-            tv_device_id.text = "Device ID: " + Constant.DEVICE_ID + " - " + StringUtil.getResString(R.string.str_enable)
+            tv_device_id.text = "设备ID: " + Constant.DEVICE_ID + " - 已启用"
         } else {
-            tv_device_id.text = "Device ID: " + Constant.DEVICE_ID
+            tv_device_id.text = "设备ID: " + Constant.DEVICE_ID
         }
 
         val serverIp =  UrlManager.build().base.substringAfterLast("//").substringBefore(":")
-        tv_local_ip.text = "IP: " + ipAddr + " - " + serverIp
-        tv_local_mac.text = "MAC: " + macAddr
-        tv_app_version.text = "Version: V" + BuildConfig.VERSION_NAME + "_" + BuildConfig.VERSION_CODE
-        tv_mcu_version.text = "MCU: " + Constant.MCU_VERSION_NUMBER
+        tv_local_ip.text = "本机IP: " + Constant.LOCAL_IP + " - " + serverIp
+        tv_local_mac.text = "本机MAC: " + Constant.LOCAL_MAC
+        tv_app_version.text = "版本信息: V" + BuildConfig.VERSION_NAME
+        tv_mcu_version.text = "MCU版本: " + Constant.MCU_VERSION_NUMBER
     }
 
     override fun bindEvent() {
         tv_btn_update_app.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
-
             (activity as CallingbedActivity).checkAppVersion()
         }
 
@@ -99,23 +95,15 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrcodeViewBinding>(
         }
 
         tv_btn_server_config.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
-
             ServerConfigDialogHelper.showPasswordDialog(activity)
         }
+    }
 
-        tv_btn_language_setting.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
-
-            LanguageSetDialogHelper.showDialog(activity)
-        }
+    override fun destory() {
     }
 
     override fun setUrlString(url: String) {
-        //
-    }
 
-    override fun destory() {
     }
 
     override fun onError(message: String, type: Int) {

+ 364 - 0
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/fragment/SipCallFragment.kt

@@ -0,0 +1,364 @@
+package com.wdkl.app.ncs.callingbed.fragment
+
+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.app.ncs.callingbed.R
+import com.wdkl.app.ncs.callingbed.settings.SettingConfig
+import com.wdkl.app.ncs.callingbed.sip.WdklSipService
+import com.wdkl.ncs.android.lib.utils.AppTool
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.common.Constant
+import com.wdkl.ncs.android.middleware.common.MessageEvent
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+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.RingPlayHelper
+import kotlinx.android.synthetic.main.sip_voice_call_layout.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.linphone.core.Call
+import org.linphone.core.Core
+import org.linphone.core.CoreListenerStub
+
+class SipCallFragment: BaseCallFragment() {
+    private val TAG = "SipCallFragment"
+
+    //来电设备id
+    var fromId: Int = -1
+
+    private var interactionVO: InteractionVO? = null
+    private var sipCore: Core? = null
+
+    private val handler = Handler(Looper.getMainLooper())
+
+    private var callEnded: Boolean = false
+
+    private var outGoing: Boolean = false
+
+    private var callSuccess: Boolean = false
+
+    override fun getLayId(): Int {
+        return R.layout.sip_voice_call_layout
+    }
+
+    override fun init() {
+        //初始化计时器
+        initCountDownTimer(sip_voice_call_timeout)
+        //tcp参数
+        if (tcpModel != null) {
+            fromId = tcpModel!!.fromId
+            interactionVO = Gson().fromJson(tcpModel!!.data.toString(), InteractionVO::class.java)
+        }
+
+        sipCore = WdklSipService.getCore()
+
+        when (callState) {
+            0 -> {
+                //去电
+                outGoing = true
+                startOutgoing()
+                RingPlayHelper.playRingTone(baseActivity, R.raw.ring_back2, true)
+            }
+
+            1 -> {
+                //来电
+                outGoing = false
+                showIncomingCall()
+
+                if (SettingConfig.getAutoAnswer(activity)) {
+                    //自动接听
+                    handler.postDelayed({
+                        if (!callEnded && Constant.CALL_STATE != Constant.CALL_CALLING) {
+                            RingPlayHelper.stopRingTone()
+                            VoiceUtil.acceptAudioCall(Constant.DEVICE_ID, fromId, interactionVO?.id)
+                            acceptCall()
+                        }
+                    }, 1200)
+                } else {
+                    RingPlayHelper.playRingTone(baseActivity, R.raw.ring_tone, true)
+                }
+            }
+
+        }
+    }
+
+    override fun bindEvent() {
+        //去电取消或通话挂断
+        sip_voice_call_hangup.setOnClickListener {
+            RingPlayHelper.stopRingTone()
+            if (Constant.CALL_STATE == Constant.CALL_CALLING) {
+                //结束sip通话
+                Constant.CALL_STATE = Constant.CALL_STANDBY
+                if (sip_voice_call_timer != null) {
+                    sip_voice_call_timer.stop()
+                }
+
+                VoiceUtil.handoffAudioCall(Constant.DEVICE_ID, fromId, interactionVO?.id)
+                callEnd(false)
+            } else {
+                Constant.CALL_STATE = Constant.CALL_STANDBY
+                VoiceUtil.cancelAudioCall(Constant.DEVICE_ID)
+                cancelCall()
+            }
+        }
+
+        //来电拒绝
+        sip_voice_call_ring_reject.setOnClickListener {
+            RingPlayHelper.stopRingTone()
+            Constant.CALL_STATE = Constant.CALL_STANDBY
+            VoiceUtil.rejectAudioCall(Constant.DEVICE_ID, fromId, interactionVO?.id)
+            callEnd(false)
+        }
+
+        //来电接听
+        sip_voice_call_ring_pickup_audio.setOnClickListener {
+            RingPlayHelper.stopRingTone()
+            Constant.CALL_STATE = Constant.CALL_INCOMING
+            VoiceUtil.acceptAudioCall(Constant.DEVICE_ID, fromId, interactionVO?.id)
+            acceptCall()
+        }
+    }
+
+    override fun destroy() {
+        cancelTimer()
+        Constant.CALL_STATE = Constant.CALL_STANDBY
+        if (sip_voice_call_timer != null) {
+            sip_voice_call_timer.stop()
+        }
+        RingPlayHelper.stopRingTone()
+    }
+
+    private fun startOutgoing() {
+        callSuccess = false
+        sip_voice_call_hangup.isEnabled = false
+        VoiceUtil.startAudioCall(Constant.DEVICE_ID)
+        Constant.CALL_STATE = Constant.CALL_OUTGOING
+        sip_voice_call_timeout.visibility = View.VISIBLE
+        sip_voice_call_timer.visibility = View.GONE
+        startTimer()
+
+        AppTool.Time.delay(5000) {
+            Log.d("tcp", "call success: $callSuccess")
+            if (!callSuccess) {
+                //呼叫失败
+                showMessage("呼叫失败,服务器无响应或网络故障!")
+                RingPlayHelper.stopRingTone()
+                cancelCall()
+            }
+        }
+    }
+
+    //去电界面
+    private fun showOutgoingCall() {
+        Constant.CALL_STATE = Constant.CALL_OUTGOING
+        sip_voice_call_calling_text.text = "呼叫成功,等待接听..."
+        ll_sip_voice_call_outgoing.visibility = View.VISIBLE
+        ll_sip_voice_call_incoming.visibility = View.GONE
+        sip_voice_call_timeout.visibility = View.VISIBLE
+        sip_voice_call_timer.visibility = View.GONE
+        startTimer()
+    }
+
+    //来电界面
+    private fun showIncomingCall() {
+        Constant.CALL_STATE = Constant.CALL_INCOMING
+        sip_voice_call_calling_text.text = "有新来电..."
+        ll_sip_voice_call_outgoing.visibility = View.GONE
+        ll_sip_voice_call_incoming.visibility = View.GONE
+        sip_voice_call_timeout.visibility = View.GONE
+        sip_voice_call_timer.visibility = View.GONE
+        cancelTimer()
+    }
+
+    //开始接听
+    private fun acceptCall() {
+        sip_voice_call_calling_text.text = "连接中..."
+        ll_sip_voice_call_outgoing.visibility = View.VISIBLE
+        ll_sip_voice_call_incoming.visibility = View.GONE
+        sip_voice_call_timeout.visibility = View.GONE
+        sip_voice_call_timer.visibility = View.GONE
+        cancelTimer()
+    }
+
+    //呼叫取消
+    private fun cancelCall() {
+        cancelTimer()
+        Constant.CALL_STATE = Constant.CALL_STANDBY
+        callEnd(false)
+    }
+
+    private fun showCalling() {
+        if (callEnded) {
+            return
+        }
+
+        Constant.CALL_STATE = Constant.CALL_CALLING
+        sip_voice_call_calling_text.text = "通话中..."
+        sip_voice_call_timeout.visibility = View.GONE
+        cancelTimer()
+        sip_voice_call_timer.visibility = View.VISIBLE
+        sip_voice_call_timer.base = SystemClock.elapsedRealtime()
+        sip_voice_call_timer.start()
+    }
+
+    //通话结束
+    override fun callEnd(handoff: Boolean) {
+        synchronized(this) {
+            if (callEnded) {
+                return
+            }
+            callEnded = true
+            Constant.CALL_STATE = Constant.CALL_STANDBY
+            if (sip_voice_call_timer != null) {
+                sip_voice_call_timer.stop()
+            }
+
+            callTerminate()
+
+            Log.e(TAG, "call end !!!!!!!!!!!!!!!!!!")
+
+            backToMain()
+        }
+    }
+
+    private fun callTerminate() {
+        if (sipCore != null && sipCore!!.callsNb > 0) {
+            var call = sipCore!!.currentCall
+            if (call == null) {
+                call = sipCore!!.calls[0]
+            }
+            call?.terminate()
+        }
+    }
+
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        when (messageEvent.type) {
+            Constant.EVENT_TCP_MSG -> {
+                if (messageEvent.message is TcpModel) {
+                    val curTcpModel = messageEvent.message as TcpModel
+                    if (curTcpModel.getType() == TcpType.VOICE) {
+                        if (curTcpModel.action == TcpAction.VoiceAction.CANCEL_BY_DOOR) {
+                            //如果当前正在通话中则不做取消处理
+                            if (Constant.CALL_STATE == Constant.CALL_CALLING) {
+                                return
+                            }
+
+                            Constant.CALL_STATE = Constant.CALL_STANDBY
+                            VoiceUtil.cancelAudioCall(Constant.DEVICE_ID)
+                            cancelCall()
+                            return
+                        }
+
+                        if (curTcpModel.data != null) {
+                            val curInteractionVO = Gson().fromJson(curTcpModel.data.toString(), InteractionVO::class.java)
+                            if (curTcpModel.getAction() == TcpAction.VoiceAction.ACCEPT) {
+                                //我方呼出,对方接受
+                                RingPlayHelper.stopRingTone()
+                                Constant.interactionId = curInteractionVO.id
+                                fromId = curTcpModel.fromId
+                                acceptCall()
+
+                                //无服务器呼叫
+                                val addressToCall = sipCore?.interpretUrl(curInteractionVO.toSipId + "@" + curInteractionVO.toEthIp)
+                                val params = sipCore?.createCallParams(null)
+                                //视频开关
+                                params?.enableVideo(false)
+                                if (addressToCall != null) {
+                                    Log.e(TAG, "send invite address: " + addressToCall.asString())
+                                    showMessage("呼叫: " + addressToCall.asString())
+                                    sipCore?.inviteAddressWithParams(addressToCall, params!!)
+                                }
+                            } else if (curTcpModel.getAction() == TcpAction.VoiceAction.REJECT) {
+                                //我方呼出,对方拒绝
+                                showMessage("对方已拒绝!")
+                                RingPlayHelper.stopRingTone()
+                                cancelCall()
+                            } else if (curTcpModel.getAction() == TcpAction.VoiceAction.CALLING) {
+                                //我方呼出,对方通话中
+                                showMessage("对方正在忙线中,暂时无法接听!")
+                                /*AppTool.Time.delay(1000) {
+                                RingPlayHelper.stopRingTone()
+                                cancelCall()
+                            }*/
+                            } else if (curTcpModel.getAction() == TcpAction.VoiceAction.SUCCESS) {
+                                //呼叫成功
+                                //本机呼叫的时候tcpModel为空,只有呼叫成功的时候才能获得对应tcp相关数据
+                                callSuccess = true
+                                sip_voice_call_hangup.isEnabled = true
+                                interactionVO = curInteractionVO
+                                Constant.interactionId = curInteractionVO.id
+                                showOutgoingCall()
+                            } else if (curTcpModel.getAction() == TcpAction.VoiceAction.FAILED) {
+                                //我方呼出,对方不在线,设备离线或其它错误
+                                callSuccess = true
+                                showMessage("呼叫失败,找不到设备或对方不在线!")
+                                RingPlayHelper.stopRingTone()
+                                cancelCall()
+                            } else if (curTcpModel.getAction() == TcpAction.VoiceAction.HANDOFF) {
+                                //对方挂断,不论我方呼出或呼入
+                                if (Constant.interactionId == curInteractionVO.id) {
+                                    RingPlayHelper.stopRingTone()
+                                    cancelCall()
+                                }
+                            } else if (curTcpModel.getAction() == TcpAction.VoiceAction.CANCEL) {
+                                //对方呼叫时取消
+                                if (Constant.interactionId == curInteractionVO.id) {
+                                    RingPlayHelper.stopRingTone()
+                                    cancelCall()
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+            //外部呼叫按键
+            Constant.EVENT_SERIAL_EVENT -> {
+                if (messageEvent.message is String) {
+                    val serialAction = messageEvent.message as String
+                    if (serialAction.equals("cancel")) {
+                        RingPlayHelper.stopRingTone()
+                        Constant.CALL_STATE = Constant.CALL_STANDBY
+                        VoiceUtil.cancelAudioCall(Constant.DEVICE_ID)
+                        cancelCall()
+                    } else if (serialAction.equals("accept")) {
+                        RingPlayHelper.stopRingTone()
+                        //Constant.CALL_STATE = Constant.CALL_CALLING
+                        VoiceUtil.acceptAudioCall(Constant.DEVICE_ID, fromId, interactionVO?.id)
+                        acceptCall()
+                    } else if (serialAction.equals("handoff")) {
+                        Constant.CALL_STATE = Constant.CALL_STANDBY
+                        VoiceUtil.handoffAudioCall(Constant.DEVICE_ID, fromId, Constant.interactionId)
+                        callEnd(false)
+                    } else if (serialAction.equals("reject")) {
+                        RingPlayHelper.stopRingTone()
+                        Constant.CALL_STATE = Constant.CALL_STANDBY
+                        VoiceUtil.rejectAudioCall(Constant.DEVICE_ID, fromId, interactionVO?.id)
+                        callEnd(false)
+                    }
+                }
+            }
+
+            Constant.EVENT_END_CALL -> {
+                Log.d(TAG, ">>>>>>>>>>>>>> EVENT_END_CALL")
+                Constant.CALL_STATE = Constant.CALL_STANDBY
+                VoiceUtil.handoffAudioCall(Constant.DEVICE_ID, fromId, Constant.interactionId)
+                callEnd(false)
+            }
+
+            Constant.SIP_CONNECTED -> {
+                showCalling()
+            }
+        }
+    }
+
+}

+ 2 - 1
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/helper/SerialPortHelper.java

@@ -176,7 +176,8 @@ public class SerialPortHelper {
                     }
                     for (int i = 0; i < size; i++) {
                         String color = nurseConfigs.get(i).getNurseColorRbg();
-                        if (StringUtils.notEmpty(color)) {
+                        String value = nurseConfigs.get(i).getNurseOptionName();
+                        if (StringUtils.notEmpty(color) && StringUtils.notEmpty(value)) {
                             int rr = (int) ((StringUtils.parseHex2Int(StringUtils.substringByLengh(color, 0, 2))) * p);
                             int gg = (int) ((StringUtils.parseHex2Int(StringUtils.substringByLengh(color, 2, 4))) * p);
                             int bb = (int) ((StringUtils.parseHex2Int(StringUtils.substringByLengh(color, 4, 6))) * p);

+ 0 - 581
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/sip/SipHelper.java.bak

@@ -1,581 +0,0 @@
-package com.wdkl.app.ncs.callingbed.sip;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.CountDownTimer;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.util.Log;
-
-import com.vvsip.ansip.IVvsipService;
-import com.vvsip.ansip.IVvsipServiceListener;
-import com.vvsip.ansip.VvsipCall;
-import com.vvsip.ansip.VvsipService;
-import com.vvsip.ansip.VvsipServiceBinder;
-import com.vvsip.ansip.VvsipTask;
-import com.wdkl.app.ncs.callingbed.helper.NetHelper;
-import com.wdkl.ncs.android.middleware.common.MessageEvent;
-
-
-import org.greenrobot.eventbus.EventBus;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.List;
-
-import static com.wdkl.app.ncs.callingbed.sip.SipStatus.REGISTERCOM;
-import static com.wdkl.app.ncs.callingbed.sip.SipStatus.REGISTERFAIL;
-import static com.wdkl.app.ncs.callingbed.sip.SipStatus.REGISTERING;
-import static com.vvsip.ansip.VvsipTask.EXOSIP_CALL_CLOSED;
-import static com.wdkl.ncs.android.middleware.common.Constant.EVENT_SIP_REGISTER_STATUS;
-
-
-public class SipHelper {
-
-    private final static String SIP_IP_END = ":5060";
-
-    private static String sipIP = "";
-    private static String sipID = "";
-    private static String sipPWD = "";
-
-    /**
-     * Sip启动注册.
-     */
-    protected int mSipRegisterTime = 5000;
-    private Handler sipRegisterHandler = null;
-    private Runnable sipRegisterRunnable = null;
-
-    /**
-     * SIP信息
-     */
-    public static final String SipInfoTag = "SipInfo";
-    /**
-     * 电话呼叫对象
-     */
-    private List<VvsipCall> mVvsipCalls = null;
-
-
-    private static SipHelper sipHelper;
-
-    public Handler getSipRegisterHandler() {
-        return sipRegisterHandler;
-    }
-
-    public Runnable getSipRegisterRunnable() {
-        return sipRegisterRunnable;
-    }
-
-    public List<VvsipCall> getmVvsipCalls() {
-        return mVvsipCalls;
-    }
-
-    private IVvsipServiceListener sipListner;
-
-
-    private Context mContext;
-
-    public static SipHelper getInstance() {
-        if (sipHelper == null) {
-            synchronized (SipHelper.class) {
-                if (sipHelper == null) {
-                    sipHelper = new SipHelper();
-                }
-            }
-        }
-        return sipHelper;
-    }
-
-    /**
-     * Instantiates a new Sip register util.
-     */
-    private SipHelper() {
-        if (mVvsipCalls == null) {
-            mVvsipCalls = new ArrayList<VvsipCall>();
-        }
-
-        // Runnable exiting the splash screen and launching the menu
-        sipRegisterRunnable = new Runnable() {
-            public void run() {
-                isSuccessRegisterSip();
-            }
-        };
-
-        // Run the exitRunnable in in mSipRegisterTime ms
-        sipRegisterHandler = new Handler();
-
-        IVvsipService sipservice = VvsipService.getService();
-        if (sipservice != null) {
-            sipRegisterHandler.postDelayed(sipRegisterRunnable, 3000);
-            return;
-        }
-        sipRegisterHandler.postDelayed(sipRegisterRunnable, mSipRegisterTime);
-    }
-
-    public void initSip(Context context, String ip, String id, String pwd) {
-        mContext = context;
-        sipIP = ip;
-        sipID = id;
-        sipPWD = pwd;
-    }
-
-    public void setSipListner(IVvsipServiceListener listner) {
-        sipListner = listner;
-    }
-
-    /*public void addSipListner(IVvsipServiceListener listner) {
-        IVvsipService sipService = VvsipService.getService();
-        if (sipService != null && listner != null) {
-            sipService.addListener(listner);
-            Log.d("sip", "add sip listner");
-        }
-    }
-
-    public void removeSipListner(IVvsipServiceListener listner) {
-        IVvsipService sipService = VvsipService.getService();
-        if (sipService != null && listner != null) {
-            sipService.removeListener(listner);
-            Log.d("sip", "remove sip listner");
-        }
-    }*/
-
-    /**
-     * 检测Sip服务是否注册成功
-     */
-    public void isSuccessRegisterSip() {
-        VvsipTask vvsipTask = VvsipTask.getVvsipTask();
-        if (vvsipTask != null && VvsipTask.global_failure != 0) {
-            /**
-             * ==================================sip服务启动失败 ================================
-             */
-        }
-    }
-
-    /**
-     * 注销Sip服务
-     */
-    public void unRegisterSip() {
-        //LogUtil.i(SipInfoTag, "lifecycle // onDestroy");
-
-        IVvsipService sipservice = VvsipService.getService();
-        if (sipservice != null) {
-            //sipservice.removeListener(sipListner);
-            sipservice.clearListener();
-        }
-
-        getSipServiceStartHandler().removeCallbacks(getSipServiceStartRunnable());
-        sipRegisterHandler.removeCallbacks(sipRegisterRunnable);
-        if (getSipServiceConnection() != null && isRegister) {
-            try {
-                mContext.unbindService(getSipServiceConnection());
-                setSipServiceConnection(null);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-        if (mVvsipCalls != null) {
-            mVvsipCalls.clear();
-            mVvsipCalls = null;
-        }
-
-        //Log.i(SipInfoTag, "lifecycle // onDestroy");
-    }
-
-    public static String sipStatus = "";
-
-    /**
-     * Sip信息获取
-     */
-    public void obtainSipInfo() {
-        if (sipStatus.equals(REGISTERCOM) && NetHelper.NetConn) {//sip注册成功并且以太网连上
-            return;
-        }
-        IVvsipService sipService = VvsipService.getService();
-        if (sipService != null && sipListner != null) {
-            //sipService.addListener(sipListner);
-            sipService.setMessageHandler(messageHandler);
-        } else {
-            //LogUtil.i(SipInfoTag, "lifecycle // _service==null");
-        }
-        sipRegister();
-        failUiRefreshSip();
-    }
-
-    private void failUiRefreshSip() {
-        if (!NetHelper.NetConn) {
-            sipStatus = REGISTERFAIL;
-            EventBus.getDefault().post(new MessageEvent(REGISTERFAIL, EVENT_SIP_REGISTER_STATUS));
-            if (mSipThread != null) {
-                mSipThread.interrupt();
-                mSipThread = null;
-            }
-            //LogUtil.e(SipInfoTag, "以太网断开,SIP UI状态刷新为失败");
-        }
-    }
-
-
-    /**
-     * Sip信息
-     */
-    private String sipinfo = "";
-    private static int handleCount = 0;
-    //Sip註冊次數
-    private CountDownTimer mCountDownAutoTimer;
-    @SuppressLint("HandlerLeak")
-    private Handler messageHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            //LogUtil.i("QASE", "handleMessage==" + " msg.obj==" + msg.obj.toString() + " msg.what==" + msg.what);
-            //LogUtil.i(SipInfoTag, "#" + msg.obj);
-            sipinfo = "" + msg.obj + sipinfo;
-            //LogUtil.i(SipInfoTag, "Sip信息" + sipinfo);
-
-            if (msg.what == 22) {//释放资源
-                //EventBus.getDefault().post(new MessageEvent(msg.what, EVENT_SIP_REGISTER_STATUS));
-            }
-
-            if (sipinfo.contains("200 OK")) {//注册成功
-                sipStatus = REGISTERCOM;
-                EventBus.getDefault().post(new MessageEvent(REGISTERCOM, EVENT_SIP_REGISTER_STATUS));
-                if (mSipThread != null) {
-                    mSipThread.interrupt();
-                    mSipThread = null;
-                }
-                if (msg.obj.toString().contains("408")) {//超时
-                    sipStatus = REGISTERFAIL;
-                    EventBus.getDefault().post(new MessageEvent(REGISTERFAIL, EVENT_SIP_REGISTER_STATUS));
-                    sipRegister();
-                }
-            } else {//注册失败
-                sipStatus = REGISTERFAIL;
-                EventBus.getDefault().post(new MessageEvent(REGISTERFAIL, EVENT_SIP_REGISTER_STATUS));
-                if (mSipThread != null) {
-                    mSipThread.interrupt();
-                    mSipThread = null;
-                }
-                sipRegister();
-            }
-            failUiRefreshSip();
-
-            if (msg.obj.toString().contains("autocall")) {
-                VvsipCall pCall = null;
-                //LogUtil.e(SipInfoTag, "onClick1");
-                for (VvsipCall _pCall : mVvsipCalls) {
-                    if (_pCall.cid > 0)
-                        //LogUtil.e(SipInfoTag, "state#" + _pCall.mState);
-                        if (_pCall.cid > 0 && _pCall.mState <= 2) {
-                            pCall = _pCall;
-                            break;
-                        }
-                }
-                //LogUtil.e(SipInfoTag, "onClick2");
-                if (pCall == null)
-                    return;
-                //LogUtil.e(SipInfoTag, "onClick3#" + pCall.mState);
-                IVvsipService _service = VvsipService.getService();
-                if (_service == null)
-                    return;
-                VvsipTask _vvsipTask = _service.getVvsipTask();
-                if (_vvsipTask == null)
-                    return;
-                pCall.stop();
-                _service.setSpeakerModeOff();
-            }
-        }
-    };
-
-    /**
-     * ====================Sip注册======================
-     */
-    private Thread mSipThread;
-
-    private static class SipThread extends Thread {
-        WeakReference<Activity> mThreadCallingBedActivity;
-
-        private SipThread(Activity activity) {
-            mThreadCallingBedActivity = new WeakReference<Activity>(activity);
-        }
-
-        @Override
-        public void run() {
-            super.run();
-            if (mThreadCallingBedActivity == null)
-                return;
-            if (mThreadCallingBedActivity.get() != null) {
-                IVvsipService sipService = VvsipService.getService();
-                try {
-                    if (sipService != null && !SipHelper.getInstance().sipinfo.contains("200 OK") && NetHelper.NetConn) {
-                        sipStatus = REGISTERING;
-                        EventBus.getDefault().post(new MessageEvent(REGISTERING, EVENT_SIP_REGISTER_STATUS));
-                        sipService.register(sipIP + SIP_IP_END, sipID, sipPWD);
-                        handleCount++;
-                        Log.e(SipInfoTag, "以太网连接,SIP UI状态刷新为注册中");
-                    } else if (sipService != null && SipHelper.getInstance().sipinfo.contains("200 OK")) {
-                        sipStatus = REGISTERCOM;
-                        EventBus.getDefault().post(new MessageEvent(REGISTERCOM, EVENT_SIP_REGISTER_STATUS));
-                    }
-                } catch (NullPointerException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-    }
-
-    private void sipRegister() {
-        synchronized (this) {
-            mSipThread = new SipThread((Activity) mContext);
-            if (handleCount < 3) {
-                if (mCountDownAutoTimer == null) {
-                    mCountDownAutoTimer = new CountDownTimer(10000, 1000) {
-                        @Override
-                        public void onTick(long l) {
-                        }
-
-                        @Override
-                        public void onFinish() {
-                            handleCount = 0;
-                            if (mSipThread != null) {
-                                mSipThread.start();
-                            }
-                            if (mCountDownAutoTimer != null) {
-                                mCountDownAutoTimer.cancel();
-                                mCountDownAutoTimer = null;
-                            }
-                        }
-                    };
-                    mCountDownAutoTimer.start();
-                }
-                return;
-            } else {
-                if (mCountDownAutoTimer != null) {
-                    mCountDownAutoTimer.cancel();
-                    mCountDownAutoTimer = null;
-                }
-            }
-            if (handleCount == 0) {
-                mSipThread.start();
-            }
-        }
-    }
-
-
-    public void setmSipThread(Thread mSipThread) {
-        this.mSipThread = mSipThread;
-    }
-
-    public Thread getmSipThread() {
-        return mSipThread;
-    }
-
-    /**
-     * 开始通话
-     */
-    public void startCall(String sipUseName) {
-        IVvsipService sipService = VvsipService.getService();
-        if (sipService == null) return;
-        //----------------------------------------------携带呼叫列表转接床头机的Mac地址--------------------------------------------------//
-        sipService.initiateOutgoingCall(sipUseName, "");
-    }
-
-    /**
-     * 结束通话
-     */
-    public void endCall() {
-        VvsipCall call = null;
-        for (VvsipCall pCall : mVvsipCalls) {
-            if (pCall.cid > 0 && pCall.mState <= 2) {
-                call = pCall;
-                break;
-            }
-        }
-        if (call == null) return;
-        IVvsipService sipService = VvsipService.getService();
-        if (sipService == null) return;
-        VvsipTask sipTask = sipService.getVvsipTask();
-        if (sipTask == null) return;
-        VvsipService.getService().mainEndCall(EXOSIP_CALL_CLOSED);
-        call.stop();
-        sipService.setSpeakerModeOff();
-        sipService.stopPlayer();
-        sipService.setAudioNormalMode();
-    }
-
-    /**
-     * 添加一个电话呼叫对象
-     *
-     * @param call
-     */
-    public void addCallObject(final VvsipCall call) {
-        try {
-            if (call == null) {
-                return;
-            }
-
-            if (mVvsipCalls == null)
-                return;
-            mVvsipCalls.add(call);
-        } catch (Exception e) {
-            //LogUtil.e(SipInfoTag, "onNewVvsipCallEvent: " + e);
-        }
-    }
-
-    /**
-     * 移除一个电话呼叫对象
-     *
-     * @param call
-     */
-    public void removeCallObject(final VvsipCall call) {
-        try {
-            if (call == null) {
-                return;
-            }
-
-            // 4 crash detected here for 4.0.9 with mVvsipCalls=NULL
-            if (mVvsipCalls == null)
-                return;
-            mVvsipCalls.remove(call);
-        } catch (Exception e) {
-            //Log.e(SipInfoTag, "onRemoveVvsipCallEvent: " + e);
-        }
-    }
-
-    /**
-     * 自动接电话
-     */
-    public void autoTalking() {
-        if (mVvsipCalls == null) {
-            mVvsipCalls = new ArrayList<VvsipCall>();
-        }
-        for (VvsipCall _pCall : mVvsipCalls) {
-            if (_pCall.cid > 0 && _pCall.mState < 2 && _pCall.mIncomingCall) {
-                // ANSWER EXISTING CALL
-                int i = _pCall.answer(200, 1);
-              //LogUtil.d(SipInfoTag, "ANSWER EXISTING CALL");
-                IVvsipService _service = VvsipService.getService();
-                if (_service != null) {
-                    if (i >= 0) {
-                        _service.stopPlayer();
-                        _service.setSpeakerModeOff();
-                        _service.setAudioInCallMode();
-                    }
-                }
-                break;
-            }
-        }
-    }
-
-    public static boolean isServiceRunning(Context context, String className) {
-        boolean isRunning = false;
-        ActivityManager activityManager = (ActivityManager) context
-                .getSystemService(Context.ACTIVITY_SERVICE);
-        List<ActivityManager.RunningServiceInfo> serviceList = activityManager
-                .getRunningServices(30);
-
-        if (!(serviceList.size() > 0)) {
-            return false;
-        }
-
-        for (int i = 0; i < serviceList.size(); i++) {
-            if (serviceList.get(i).service.getClassName().equals(className) == true) {
-                isRunning = true;
-                break;
-            }
-        }
-        return isRunning;
-    }
-
-    /**
-     * #############################
-     * <p>
-     * Sip启动服务.
-     * <p>
-     * #############################
-     */
-    private static Handler sipServiceStartHandler = null;
-    private static Runnable sipServiceStartRunnable = null;
-    private static ServiceConnection sipServiceConnection;
-
-    public static Runnable getSipServiceStartRunnable() {
-        return sipServiceStartRunnable;
-    }
-
-    public static Handler getSipServiceStartHandler() {
-        return sipServiceStartHandler;
-    }
-
-    public static ServiceConnection getSipServiceConnection() {
-        return sipServiceConnection;
-    }
-
-    public static void setSipServiceConnection(ServiceConnection sipServiceConnections) {
-        sipServiceConnection = sipServiceConnections;
-    }
-
-    /**
-     * 启动服务
-     */
-    public static Boolean isRegister = false;//是否注册
-
-    public void sipStartService() {
-        sipServiceStartHandler = new Handler();
-
-        sipServiceStartRunnable = new Runnable() {
-            public void run() {
-                if (mContext == null) {
-                    sipServiceStartHandler.postDelayed(sipServiceStartRunnable, 1000);
-                    return;
-                }
-                Intent intent = new Intent(mContext.getApplicationContext(), VvsipService.class);
-                mContext.startService(intent);
-
-                sipServiceConnection = new ServiceConnection() {
-                    public void onServiceConnected(ComponentName name, IBinder service) {
-                        IVvsipService sipservice = ((VvsipServiceBinder) service).getService();
-                        if (sipservice != null && sipListner != null) {
-                            //LogUtil.i(SipInfoTag, "Connected!");
-                            sipservice.clearListener();
-                            sipservice.addListener(sipListner);
-                            SipHelper.getInstance().obtainSipInfo();//Sip信息获取
-                        }
-                    }
-
-                    public void onServiceDisconnected(ComponentName name) {
-                        //LogUtil.i(SipInfoTag, "Disconnected!");
-                    }
-                };
-
-                isRegister = mContext.bindService(intent, sipServiceConnection, Context.BIND_AUTO_CREATE);
-            }
-        };
-
-        sipServiceStartHandler.postDelayed(sipServiceStartRunnable, 0);
-    }
-
-    /**
-     * 用来解析错误代码
-     */
-    public static String analyseErrorCode(String errorCode) {
-        switch (errorCode) {
-            case "200":
-                return "成功";
-            case "408":
-                return "请求超时";
-            case "400":
-                return "服务器不支持请求的语法";
-            case "401":
-                return "未授权";
-            case "403":
-                return "服务器禁止请求";
-            case "404":
-                return "服务器找不到";
-            default:
-                return "未知错误";
-        }
-    }
-
-}

+ 250 - 0
android_bed/src/main/h5_3128/java/com/wdkl/app/ncs/callingbed/sip/WdklSipService.java

@@ -0,0 +1,250 @@
+package com.wdkl.app.ncs.callingbed.sip;
+
+import android.app.Service;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Handler;
+import android.os.IBinder;
+import android.support.annotation.Nullable;
+import android.widget.Toast;
+
+import com.wdkl.app.ncs.callingbed.R;
+import com.wdkl.ncs.android.middleware.common.Constant;
+import com.wdkl.ncs.android.middleware.common.MessageEvent;
+
+import org.greenrobot.eventbus.EventBus;
+import org.linphone.core.Call;
+import org.linphone.core.CallParams;
+import org.linphone.core.Core;
+import org.linphone.core.CoreListenerStub;
+import org.linphone.core.Factory;
+import org.linphone.core.LogCollectionState;
+import org.linphone.core.ProxyConfig;
+import org.linphone.core.RegistrationState;
+import org.linphone.core.tools.Log;
+import org.linphone.mediastream.Version;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class WdklSipService extends Service {
+    private static final String START_SIPPHONE_LOGS = " ==== Device information dump ====";
+    //单例化服务,以便全局调用
+    private static WdklSipService sInstance;
+
+    private Handler mHandler;
+    private Timer mTimer;
+
+    private Core mCore;
+    private CoreListenerStub mCoreListener;
+
+    public static boolean isReady() {
+        return sInstance != null;
+    }
+
+    public static WdklSipService getInstance() {
+        return sInstance;
+    }
+
+    public static Core getCore() {
+        return sInstance.mCore;
+    }
+
+    @Nullable
+    @Override
+    public IBinder onBind(Intent intent) {
+        return null;
+    }
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+
+        Toast.makeText(WdklSipService.this, "wdkl sip service", Toast.LENGTH_SHORT).show();
+
+        //首次调用必须使用 Factory相关方法
+        //这里开户调试日志及设置路径
+        String basePath = getFilesDir().getAbsolutePath();
+        Factory.instance().setLogCollectionPath(basePath);
+        Factory.instance().enableLogCollection(LogCollectionState.Disabled);
+        Factory.instance().setDebugMode(false, getString(R.string.app_name));
+
+        //收集一些设备信息
+        Log.i(START_SIPPHONE_LOGS);
+        dumpDeviceInformation();
+        dumpInstalledLinphoneInformation();
+
+        mHandler = new Handler();
+        //主监听器,根据事件调用界面
+        mCoreListener = new CoreListenerStub() {
+            @Override
+            public void onCallStateChanged(Core core, Call call, Call.State state, String message) {
+                Toast.makeText(WdklSipService.this, message, Toast.LENGTH_SHORT).show();
+                android.util.Log.d("sipCall", ">>>>>>>>>>>> call state: " + state + ", " + call.getRemoteAddress().asString());
+
+                if (state == Call.State.IncomingReceived || state == Call.State.IncomingEarlyMedia) {
+                    //来电时将自动接听
+                    CallParams params = getCore().createCallParams(call);
+                    if (params != null) {
+                        params.enableVideo(false);
+                    }
+                    call.acceptWithParams(params);
+                } else if (state == Call.State.Connected) {
+                    EventBus.getDefault().post(new MessageEvent(state, Constant.SIP_CONNECTED));
+                } else if (state == Call.State.End || state == Call.State.Released){
+                    EventBus.getDefault().post(new MessageEvent(state, Constant.EVENT_END_CALL));
+                }
+            }
+
+            @Override
+            public void onRegistrationStateChanged(Core core, ProxyConfig cfg, RegistrationState state, String message) {
+                EventBus.getDefault().post(new MessageEvent(state, Constant.EVENT_SIP_REGISTER_STATUS));
+            }
+        };
+
+        try {
+            //复制一些源资源
+            //默认配置只能在首次时安装一次
+            copyIfNotExist(R.raw.linphonerc_default, basePath + "/.wdkl_sip_rc");
+            //用户配置,每次复制
+            copyFromPackage(R.raw.linphonerc_factory, "wdkl_sip_rc");
+        } catch (IOException ioe) {
+            Log.e(ioe);
+        }
+
+        //创建SIP核心并加载监听器
+        mCore = Factory.instance()
+                .createCore(basePath + "/.wdkl_sip_rc", basePath + "/wdkl_sip_rc", this);
+        mCore.addListener(mCoreListener);
+        //SIP核心配置完成
+        configureCore();
+    }
+
+    @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+        super.onStartCommand(intent, flags, startId);
+        Toast.makeText(WdklSipService.this, "sip服务已启动", Toast.LENGTH_SHORT).show();
+
+        //如果服务已经在运行,则返回
+        if (sInstance != null) {
+            return START_STICKY;
+        }
+
+        //一旦服务启动,则一直保持
+        sInstance = this;
+
+        //SIP核心在创建和配置完成后,开启
+        mCore.start();
+        //必须定时运行 SIP核心 iterate()
+        TimerTask lTask = new TimerTask() {
+            @Override
+            public void run() {
+                mHandler.post(
+                        new Runnable() {
+                            @Override
+                            public void run() {
+                                if (mCore != null) {
+                                    mCore.iterate();
+                                }
+                            }
+                        });
+            }
+        };
+        mTimer = new Timer("wdkl sip scheduler");
+        mTimer.schedule(lTask, 0, 20);
+
+        return START_STICKY;
+    }
+
+    @Override
+    public void onDestroy() {
+        mCore.removeListener(mCoreListener);
+        mTimer.cancel();
+        mCore.stop();
+        // A stopped Core can be started again
+        // To ensure resources are freed, we must ensure it will be garbage collected
+        mCore = null;
+        // Don't forget to free the singleton as well
+        sInstance = null;
+
+        super.onDestroy();
+    }
+
+    @Override
+    public void onTaskRemoved(Intent rootIntent) {
+        // For this sample we will kill the Service at the same time we kill the app
+        stopSelf();
+
+        super.onTaskRemoved(rootIntent);
+    }
+
+    private void configureCore() {
+        // We will create a directory for user signed certificates if needed
+        String basePath = getFilesDir().getAbsolutePath();
+        String userCerts = basePath + "/user-certs";
+        File f = new File(userCerts);
+        if (!f.exists()) {
+            if (!f.mkdir()) {
+                Log.e(userCerts + " can't be created.");
+            }
+        }
+        mCore.setUserCertificatesPath(userCerts);
+    }
+
+    private void dumpDeviceInformation() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("DEVICE=").append(Build.DEVICE).append("\n");
+        sb.append("MODEL=").append(Build.MODEL).append("\n");
+        sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n");
+        sb.append("SDK=").append(Build.VERSION.SDK_INT).append("\n");
+        sb.append("Supported ABIs=");
+        for (String abi : Version.getCpuAbis()) {
+            sb.append(abi).append(", ");
+        }
+        sb.append("\n");
+        Log.i(sb.toString());
+    }
+
+    private void dumpInstalledLinphoneInformation() {
+        PackageInfo info = null;
+        try {
+            info = getPackageManager().getPackageInfo(getPackageName(), 0);
+        } catch (PackageManager.NameNotFoundException nnfe) {
+            Log.e(nnfe);
+        }
+
+        if (info != null) {
+            Log.i(
+                    "[Service] sipphone version is ",
+                    info.versionName + " (" + info.versionCode + ")");
+        } else {
+            Log.i("[Service] sipphone version is unknown");
+        }
+    }
+
+    private void copyIfNotExist(int ressourceId, String target) throws IOException {
+        File lFileToCopy = new File(target);
+        if (!lFileToCopy.exists()) {
+            copyFromPackage(ressourceId, lFileToCopy.getName());
+        }
+    }
+
+    private void copyFromPackage(int ressourceId, String target) throws IOException {
+        FileOutputStream lOutputStream = openFileOutput(target, 0);
+        InputStream lInputStream = getResources().openRawResource(ressourceId);
+        int readByte;
+        byte[] buff = new byte[8048];
+        while ((readByte = lInputStream.read(buff)) != -1) {
+            lOutputStream.write(buff, 0, readByte);
+        }
+        lOutputStream.flush();
+        lOutputStream.close();
+        lInputStream.close();
+    }
+}

+ 11 - 10
android_bed/src/main/h5_3128/res/layout/callingbed_main_lay.xml

@@ -3,7 +3,7 @@
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:background="#EAF2F9">
+        android:background="@mipmap/bg_main">
 
         <include
             android:id="@+id/activity_calling_bed_layout_title"
@@ -16,7 +16,8 @@
             android:layout_below="@id/activity_calling_bed_layout_title"
             android:layout_marginTop="4dp"
             android:paddingLeft="4dp"
-            android:paddingRight="4dp">
+            android:paddingRight="4dp"
+            android:orientation="vertical">
 
             <!--左侧护理列表-->
             <android.support.v7.widget.RecyclerView
@@ -33,7 +34,7 @@
             android:layout_height="match_parent"
             android:layout_marginTop="10dp"
             android:layout_marginBottom="2dp"
-            android:layout_marginRight="10dp"
+            android:layout_marginRight="4dp"
             android:layout_toRightOf="@id/rl_left_view"
             android:layout_below="@id/activity_calling_bed_layout_title" />
 
@@ -71,7 +72,7 @@
 
         <LinearLayout
             android:id="@+id/right_menu"
-            android:layout_width="140dp"
+            android:layout_width="110dp"
             android:layout_height="match_parent"
             android:layout_alignParentRight="true"
             android:background="@mipmap/bg_right"
@@ -96,7 +97,7 @@
                     android:background="@mipmap/bg_bottom_btn"
                     android:drawableLeft="@mipmap/ic_home"
                     android:drawablePadding="4dp"
-                    android:text="@string/str_home"
+                    android:text="首页"
                     android:textColor="@drawable/selector_bottom_btn_text_color"
                     android:textSize="24sp"/>
 
@@ -105,7 +106,7 @@
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="0dp"
-                android:layout_weight="1">
+                android:layout_weight="1" >
 
                 <TextView
                     android:id="@+id/activity_calling_bed_layout_tv_cost_text"
@@ -117,7 +118,7 @@
                     android:background="@mipmap/bg_bottom_btn"
                     android:drawableLeft="@mipmap/ic_cost"
                     android:drawablePadding="4dp"
-                    android:text="@string/str_fees"
+                    android:text="费用"
                     android:textColor="@drawable/selector_bottom_btn_text_color"
                     android:textSize="24sp"/>
 
@@ -138,7 +139,7 @@
                     android:background="@mipmap/bg_bottom_btn"
                     android:drawableLeft="@mipmap/ic_more"
                     android:drawablePadding="4dp"
-                    android:text="@string/str_more"
+                    android:text="更多"
                     android:textColor="@drawable/selector_bottom_btn_text_color"
                     android:textSize="24sp"/>
 
@@ -159,7 +160,7 @@
                     android:background="@mipmap/bg_bottom_btn"
                     android:drawableLeft="@mipmap/ic_support"
                     android:drawablePadding="4dp"
-                    android:text="@string/str_support"
+                    android:text="增援"
                     android:textColor="@drawable/selector_bottom_btn_text_color"
                     android:textSize="24sp"/>
 
@@ -180,7 +181,7 @@
                     android:background="@mipmap/bg_bottom_btn"
                     android:drawableLeft="@mipmap/ic_call"
                     android:drawablePadding="4dp"
-                    android:text="@string/str_call"
+                    android:text="呼叫"
                     android:textColor="@drawable/selector_bottom_btn_text_color"
                     android:textSize="24sp"/>
 

+ 11 - 19
android_bed/src/main/h5_3128/res/layout/item_nurse_config.xml

@@ -5,40 +5,32 @@
     android:layout_width="match_parent"
     android:layout_height="80dp"
     android:layout_marginTop="6dp"
+    android:padding="6dp"
     android:background="#E7E7E7"
     android:orientation="vertical">
 
-    <!--<TextView
-        android:id="@+id/tv_nurse_color"
-        android:layout_width="8dp"
-        android:layout_height="match_parent"
-        android:background="@color/main_color"/>-->
-
     <TextView
         android:id="@+id/tv_nurse_config_name"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"
-        android:paddingLeft="6dp"
-        android:paddingTop="6dp"
+        android:layout_height="32dp"
         android:singleLine="true"
         android:ellipsize="end"
         android:text="@string/default_nurse_config_name"
         android:textSize="20sp"
-        android:textColor="@color/white"/>
+        android:textColor="@color/white" />
 
-    <TextView
+    <com.wdkl.ncs.android.lib.widget.MarqueeTextView
         android:id="@+id/tv_nurse_config_value"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"
-        android:paddingRight="6dp"
-        android:paddingBottom="6dp"
+        android:layout_height="match_parent"
+        android:gravity="center_vertical|right"
+        android:ellipsize="marquee"
+        android:focusable="true"
+        android:focusableInTouchMode="true"
+        android:marqueeRepeatLimit="-1"
         android:singleLine="true"
-        android:ellipsize="end"
-        android:gravity="right|bottom"
         android:text="@string/str_empty"
-        android:textSize="22sp"
+        android:textSize="28sp"
         android:textColor="@color/white"/>
 
 </LinearLayout>

+ 96 - 106
android_bed/src/main/h5_3128/res/layout/main_view.xml

@@ -6,11 +6,11 @@
         android:layout_height="match_parent">
 
         <include android:id="@+id/lay_main_bed_name"
-            layout="@layout/view_bed_name"/>
+            layout="@layout/view_bed_name_home"/>
 
         <LinearLayout
             android:id="@+id/ll_doctor_nurse_view"
-            android:layout_width="140dp"
+            android:layout_width="120dp"
             android:layout_height="match_parent"
             android:layout_below="@id/lay_main_bed_name"
             android:layout_alignParentRight="true"
@@ -23,30 +23,31 @@
                 android:layout_width="match_parent"
                 android:layout_height="0dp"
                 android:layout_weight="1"
-                android:gravity="center_horizontal"
+                android:gravity="center"
                 android:orientation="vertical"
-                android:background="@color/white">
+                android:background="#37A1D5">
                 <ImageView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="4dp"
-                    android:src="@mipmap/ic_doctor_default"/>
+                    android:src="@mipmap/ic_doctor_default"
+                    android:visibility="gone"/>
                 <TextView
-                    android:id="@+id/tv_doctor_title"
+                    android:id="@+id/tv_doctor_name"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="4dp"
-                    android:textColor="#B4B4B4"
-                    android:textSize="18sp"
-                    android:text="@string/doctor_title"/>
+                    android:textColor="@color/white"
+                    android:textSize="32sp"
+                    android:text="@string/str_empty"/>
                 <TextView
-                    android:id="@+id/tv_doctor_name"
+                    android:id="@+id/tv_doctor_title"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginTop="4dp"
-                    android:textColor="@color/black"
-                    android:textSize="18sp"
-                    android:text="@string/str_empty"/>
+                    android:layout_marginTop="6dp"
+                    android:textColor="@color/white"
+                    android:textSize="24sp"
+                    android:text="@string/doctor_title"/>
             </LinearLayout>
 
             <!--责任护士-->
@@ -55,31 +56,32 @@
                 android:layout_width="match_parent"
                 android:layout_height="0dp"
                 android:layout_weight="1"
-                android:layout_marginTop="10dp"
-                android:gravity="center_horizontal"
+                android:layout_marginTop="4dp"
+                android:gravity="center"
                 android:orientation="vertical"
-                android:background="@color/white">
+                android:background="#37A1D5">
                 <ImageView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="4dp"
-                    android:src="@mipmap/ic_nurse_default"/>
+                    android:src="@mipmap/ic_nurse_default"
+                    android:visibility="gone"/>
                 <TextView
-                    android:id="@+id/tv_nurse_title"
+                    android:id="@+id/tv_nurse_name"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="4dp"
-                    android:textColor="#B4B4B4"
-                    android:textSize="18sp"
-                    android:text="@string/nurse_title"/>
+                    android:textColor="@color/white"
+                    android:textSize="32sp"
+                    android:text="@string/str_empty"/>
                 <TextView
-                    android:id="@+id/tv_nurse_name"
+                    android:id="@+id/tv_nurse_title"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_marginTop="4dp"
-                    android:textColor="@color/black"
-                    android:textSize="18sp"
-                    android:text="@string/str_empty"/>
+                    android:layout_marginTop="6dp"
+                    android:textColor="@color/white"
+                    android:textSize="24sp"
+                    android:text="@string/nurse_title"/>
             </LinearLayout>
         </LinearLayout>
 
@@ -89,7 +91,7 @@
             android:layout_height="match_parent"
             android:layout_below="@id/lay_main_bed_name"
             android:layout_toLeftOf="@id/ll_doctor_nurse_view"
-            android:layout_marginRight="10dp"
+            android:layout_marginRight="4dp"
             android:layout_marginTop="4dp"
             android:layout_marginBottom="4dp">
             <!--无人入住时展示-->
@@ -122,10 +124,8 @@
                 android:id="@+id/ll_custom_view"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:paddingTop="4dp"
-                android:paddingLeft="12dp"
-                android:paddingRight="12dp"
-                android:background="@color/white"
+                android:padding="2dp"
+                android:background="#D5EFFC"
                 android:orientation="vertical"
                 android:visibility="gone">
 
@@ -156,18 +156,21 @@
                             android:textSize="20sp"
                             android:textColor="@color/white"/>
 
-                        <TextView
+                        <com.wdkl.ncs.android.lib.widget.MarqueeTextView
                             android:id="@+id/tv_nurse_value6"
                             android:layout_width="match_parent"
                             android:layout_height="0dp"
                             android:layout_weight="1"
                             android:paddingRight="6dp"
                             android:paddingBottom="6dp"
+                            android:ellipsize="marquee"
+                            android:focusable="true"
+                            android:focusableInTouchMode="true"
+                            android:marqueeRepeatLimit="marquee_forever"
                             android:singleLine="true"
-                            android:ellipsize="end"
                             android:gravity="right|bottom"
                             android:text="@string/str_empty"
-                            android:textSize="22sp"
+                            android:textSize="24sp"
                             android:textColor="@color/white"/>
                     </LinearLayout>
 
@@ -191,18 +194,21 @@
                             android:textSize="20sp"
                             android:textColor="@color/white"/>
 
-                        <TextView
+                        <com.wdkl.ncs.android.lib.widget.MarqueeTextView
                             android:id="@+id/tv_nurse_value7"
                             android:layout_width="match_parent"
                             android:layout_height="0dp"
                             android:layout_weight="1"
                             android:paddingRight="6dp"
                             android:paddingBottom="6dp"
+                            android:ellipsize="marquee"
+                            android:focusable="true"
+                            android:focusableInTouchMode="true"
+                            android:marqueeRepeatLimit="marquee_forever"
                             android:singleLine="true"
-                            android:ellipsize="end"
                             android:gravity="right|bottom"
                             android:text="@string/str_empty"
-                            android:textSize="22sp"
+                            android:textSize="24sp"
                             android:textColor="@color/white"/>
                     </LinearLayout>
 
@@ -226,101 +232,85 @@
                             android:textSize="20sp"
                             android:textColor="@color/white"/>
 
-                        <TextView
+                        <com.wdkl.ncs.android.lib.widget.MarqueeTextView
                             android:id="@+id/tv_nurse_value8"
                             android:layout_width="match_parent"
                             android:layout_height="0dp"
                             android:layout_weight="1"
                             android:paddingRight="6dp"
                             android:paddingBottom="6dp"
+                            android:ellipsize="marquee"
+                            android:focusable="true"
+                            android:focusableInTouchMode="true"
+                            android:marqueeRepeatLimit="marquee_forever"
                             android:singleLine="true"
-                            android:ellipsize="end"
                             android:gravity="right|bottom"
                             android:text="@string/str_empty"
-                            android:textSize="22sp"
+                            android:textSize="24sp"
                             android:textColor="@color/white"/>
                     </LinearLayout>
                 </LinearLayout>
 
-                <TextView
+                <com.wdkl.ncs.android.lib.widget.MarqueeTextView
                     android:id="@+id/tv_custom_name"
-                    android:layout_width="wrap_content"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:textSize="56sp"
+                    android:layout_toLeftOf="@id/ll_custom_age_gender"
+                    android:textSize="120sp"
                     android:textStyle="bold"
-                    android:textColor="@color/main_color"
-                    android:text="---"/>
-                <TextView
-                    android:id="@+id/tv_custom_gender"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/tv_custom_name"
-                    android:layout_alignBottom="@id/tv_custom_name"
-                    android:background="@mipmap/ic_gender_male"
-                    android:layout_marginLeft="10dp"
-                    android:layout_marginBottom="10dp"/>
-                <TextView
-                    android:id="@+id/tv_custom_age"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/tv_custom_gender"
-                    android:layout_alignBottom="@id/tv_custom_name"
-                    android:layout_marginLeft="10dp"
-                    android:textSize="28sp"
-                    android:textColor="#B4B4B4"
-                    android:text="--"/>
+                    android:textColor="@color/black"
+                    android:text="---"
+                    android:ellipsize="marquee"
+                    android:focusable="true"
+                    android:focusableInTouchMode="true"
+                    android:marqueeRepeatLimit="-1"
+                    android:singleLine="true"/>
+                <LinearLayout
+                    android:id="@+id/ll_custom_age_gender"
+                    android:layout_width="100dp"
+                    android:layout_height="140dp"
+                    android:layout_marginRight="6dp"
+                    android:layout_marginLeft="6dp"
+                    android:layout_alignParentRight="true"
+                    android:gravity="bottom|center_horizontal"
+                    android:orientation="vertical">
+                    <TextView
+                        android:id="@+id/tv_custom_gender"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textSize="48sp"
+                        android:textColor="@color/black"
+                        android:textStyle="bold"/>
+                    <TextView
+                        android:id="@+id/tv_custom_age"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textSize="44sp"
+                        android:textColor="@color/black"
+                        android:text="-"
+                        android:textStyle="bold"/>
+                </LinearLayout>
                 <TextView
                     android:id="@+id/tv_custom_indate"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_below="@id/tv_custom_name"
-                    android:layout_marginTop="10dp"
-                    android:textSize="22sp"
-                    android:textColor="#131313"
+                    android:layout_alignParentBottom="true"
+                    android:layout_marginBottom="6dp"
+                    android:layout_marginLeft="4dp"
+                    android:textSize="24sp"
+                    android:textColor="@color/black"
                     android:text="@string/indate"/>
                 <TextView
                     android:id="@+id/tv_custom_card_no"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_below="@id/tv_custom_indate"
-                    android:layout_marginTop="10dp"
-                    android:textSize="22sp"
-                    android:textColor="#131313"
-                    android:text=""/>
-                <!--<TextView
-                    android:id="@+id/tv_order_title"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_below="@id/tv_custom_indate"
-                    android:layout_marginTop="20dp"
-                    android:padding="10dp"
-                    android:background="#F3F9FE"
-                    android:drawableLeft="@mipmap/ic_order"
-                    android:drawablePadding="10dp"
+                    android:layout_alignParentBottom="true"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginBottom="6dp"
+                    android:layout_marginRight="4dp"
                     android:textSize="24sp"
                     android:textColor="@color/black"
-                    android:text=""/>-->
-                <com.wdkl.ncs.android.lib.widget.MarqueeTextView
-                    android:id="@+id/tv_order_content"
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_below="@id/tv_custom_card_no"
-                    android:layout_above="@id/ll_nurse_more"
-                    android:layout_marginTop="8dp"
-                    android:padding="10dp"
-                    android:ellipsize="marquee"
-                    android:focusable="true"
-                    android:focusableInTouchMode="true"
-                    android:marqueeRepeatLimit="marquee_forever"
-                    android:scrollHorizontally="true"
-                    android:singleLine="true"
-                    android:background="#F3F9FE"
-                    android:scrollbars="vertical"
-                    android:fadeScrollbars="true"
-                    android:textSize="24sp"
-                    android:textColor="#131313"
-                    android:text="@string/str_empty"
-                    android:lineSpacingExtra="12dp"/>
+                    android:text=""/>
             </RelativeLayout>
         </FrameLayout>
 

+ 2 - 2
android_bed/src/main/h5_3128/res/layout/main_view_layout.xml

@@ -25,7 +25,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginLeft="10dp"
-            android:text=""/>
+            android:text="本机ip"/>
     </LinearLayout>
 
     <LinearLayout
@@ -43,7 +43,7 @@
             android:id="@+id/edit_sip_target"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="" />
+            android:text="目标ip" />
     </LinearLayout>
 
 

+ 2 - 6
android_bed/src/main/h5_3128/res/layout/qrcode_view.xml

@@ -19,8 +19,8 @@
             android:orientation="vertical">
             <ImageView
                 android:id="@+id/view_qr_code"
-                android:layout_width="180dp"
-                android:layout_height="180dp"
+                android:layout_width="170dp"
+                android:layout_height="170dp"
                 android:layout_gravity="center_horizontal"/>
 
             <TextView
@@ -36,7 +36,6 @@
                 android:id="@+id/tv_local_ip"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="4dp"
                 android:layout_marginLeft="10dp"
                 android:text="IP:"
                 android:textColor="@color/black"
@@ -46,7 +45,6 @@
                 android:id="@+id/tv_local_mac"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="4dp"
                 android:layout_marginLeft="10dp"
                 android:text="MAC:"
                 android:textColor="@color/black"
@@ -56,7 +54,6 @@
                 android:id="@+id/tv_app_version"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="4dp"
                 android:layout_marginLeft="10dp"
                 android:text="Version:"
                 android:textColor="@color/black"
@@ -66,7 +63,6 @@
                 android:id="@+id/tv_mcu_version"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="4dp"
                 android:layout_marginLeft="10dp"
                 android:text="MCU:"
                 android:textColor="@color/black"

+ 118 - 0
android_bed/src/main/h5_3128/res/layout/sip_voice_call_layout.xml

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout>
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/gray_deep">
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+
+            <!--语音呼叫layout-->
+            <LinearLayout
+                android:id="@+id/ll_sip_voice_call"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_horizontal"
+                android:orientation="vertical">
+
+                <ImageView
+                    android:id="@+id/sip_voice_call_head_img"
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_marginTop="100dp"
+                    android:scaleType="centerInside"
+                    android:src="@drawable/ic_nurse" />
+
+                <TextView
+                    android:id="@+id/sip_voice_call_calling_text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="20dp"
+                    android:gravity="center"
+                    android:text="正在呼叫..."
+                    android:textColor="#9E9E9F"
+                    android:textSize="32sp" />
+
+                <TextView
+                    android:id="@+id/sip_voice_call_timeout"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="20dp"
+                    android:gravity="center"
+                    android:text="倒计时: 00"
+                    android:textColor="#9E9E9F"
+                    android:textSize="24sp" />
+            </LinearLayout>
+
+            <!--呼出-->
+            <LinearLayout
+                android:id="@+id/ll_sip_voice_call_outgoing"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="true"
+                android:layout_centerHorizontal="true"
+                android:layout_marginBottom="40dp"
+                android:orientation="vertical">
+
+                <Chronometer
+                    android:id="@+id/sip_voice_call_timer"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:text="00:00"
+                    android:textColor="@color/white"
+                    android:textSize="24sp" />
+
+                <ImageView
+                    android:id="@+id/sip_voice_call_hangup"
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:layout_marginTop="20dp"
+                    android:src="@drawable/selector_call_hangup"
+                    android:visibility="gone"/>
+            </LinearLayout>
+
+            <!--来电-->
+            <LinearLayout
+                android:id="@+id/ll_sip_voice_call_incoming"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="true"
+                android:layout_centerHorizontal="true"
+                android:layout_marginBottom="40dp"
+                android:gravity="bottom"
+                android:orientation="horizontal"
+                android:visibility="gone">
+
+                <View
+                    android:layout_width="0dp"
+                    android:layout_height="1dp"
+                    android:layout_weight="2" />
+
+                <ImageView
+                    android:id="@+id/sip_voice_call_ring_reject"
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:src="@drawable/selector_call_hangup" />
+
+                <View
+                    android:layout_width="0dp"
+                    android:layout_height="1dp"
+                    android:layout_weight="1" />
+
+                <ImageView
+                    android:id="@+id/sip_voice_call_ring_pickup_audio"
+                    android:layout_width="100dp"
+                    android:layout_height="100dp"
+                    android:src="@drawable/selector_call_answer" />
+
+                <View
+                    android:layout_width="0dp"
+                    android:layout_height="1dp"
+                    android:layout_weight="2" />
+            </LinearLayout>
+        </RelativeLayout>
+    </FrameLayout>
+</layout>

+ 19 - 13
android_bed/src/main/h5_3128/res/layout/view_bed_name.xml

@@ -2,28 +2,34 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="96dp">
+    android:layout_height="114dp"
+    android:background="@color/white">
 
-    <TextView
-        android:id="@+id/tv_bed_name"
+    <LinearLayout
         android:layout_width="0dp"
         android:layout_height="match_parent"
-        android:layout_weight="1"
-        android:layout_marginTop="-10dp"
-        android:background="@color/white"
-        android:paddingLeft="24dp"
-        android:gravity="center_vertical"
-        android:textColor="@color/main_color"
-        android:textSize="86sp"
-        android:textStyle="bold"
-        android:text="--"/>
+        android:layout_marginTop="-16dp"
+        android:layout_weight="1">
+        <com.wdkl.ncs.android.lib.widget.MarqueeTextView
+            android:id="@+id/tv_bed_name"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:gravity="center_horizontal"
+            android:textColor="@color/black"
+            android:textSize="110sp"
+            android:textStyle="bold"
+            android:text="--"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:focusable="true"
+            android:focusableInTouchMode="true"/>
+    </LinearLayout>
 
     <TextView
         android:id="@+id/tv_version"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:padding="6dp"
-        android:background="@color/white"
         android:gravity="bottom"
         android:textColor="@color/black"
         android:textSize="16sp"

+ 58 - 0
android_bed/src/main/h5_3128/res/layout/view_bed_name_home.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="200dp"
+    android:background="@color/white">
+
+    <com.wdkl.ncs.android.lib.widget.MarqueeTextView
+        android:id="@+id/tv_home_bed_name"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="-10dp"
+        android:layout_above="@id/tv_home_version"
+        android:layout_toLeftOf="@+id/main_view_qr_code"
+        android:ellipsize="marquee"
+        android:focusable="true"
+        android:focusableInTouchMode="true"
+        android:gravity="center_horizontal"
+        android:marqueeRepeatLimit="-1"
+        android:singleLine="true"
+        android:text="--"
+        android:textColor="@color/black"
+        android:textSize="164sp"
+        android:textStyle="bold" />
+
+    <ImageView
+        android:id="@+id/main_view_qr_code"
+        android:layout_width="168dp"
+        android:layout_height="168dp"
+        android:layout_marginTop="10dp"
+        android:layout_toLeftOf="@+id/tv_qr_code_title"
+        android:visibility="gone" />
+
+    <TextView
+        android:id="@+id/tv_qr_code_title"
+        android:layout_width="24dp"
+        android:layout_height="168dp"
+        android:layout_alignParentRight="true"
+        android:layout_marginTop="10dp"
+        android:gravity="center"
+        android:text="便民服务"
+        android:textColor="@color/main_color"
+        android:textSize="20sp"
+        android:visibility="gone" />
+
+    <TextView
+        android:id="@+id/tv_home_version"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:layout_alignParentRight="true"
+        android:layout_marginRight="24dp"
+        android:paddingLeft="6dp"
+        android:paddingRight="6dp"
+        android:text="v--"
+        android:textColor="@color/black"
+        android:textSize="16sp" />
+
+</RelativeLayout>

+ 8 - 7
android_bed/src/main/h5_3128/res/layout/view_title_layout.xml

@@ -8,11 +8,11 @@
     <!--SIP状态图标-->
     <TextView
         android:id="@+id/view_title_layout_tv_point"
-        android:layout_width="12dp"
-        android:layout_height="12dp"
+        android:layout_width="20dp"
+        android:layout_height="20dp"
         android:layout_centerVertical="true"
-        android:layout_marginLeft="20dp"
-        android:background="@color/red_color"/>
+        android:layout_marginLeft="10dp"
+        android:background="@color/register_text_color"/>
 
     <!--医院名称-->
     <TextView
@@ -20,7 +20,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_centerVertical="true"
-        android:layout_marginLeft="20dp"
+        android:layout_marginLeft="4dp"
         android:layout_toRightOf="@+id/view_title_layout_tv_point"
         android:text="----"
         android:textColor="@color/main_color"
@@ -34,6 +34,7 @@
         android:layout_centerVertical="true"
         android:format12Hour="yyyy-MM-dd HH:mm EEEE"
         android:format24Hour="yyyy-MM-dd HH:mm EEEE"
+        android:timeZone="GMT+8"
         android:textColor="@color/main_color"
         android:textSize="@dimen/font_size_20" />
 
@@ -45,9 +46,9 @@
         android:layout_centerVertical="true"
         android:layout_marginRight="4dp"
         android:layout_toLeftOf="@+id/view_title_layout_ll_right"
-        android:text="ID:"
+        android:text="设备ID:"
         android:textColor="@color/main_color"
-        android:textSize="16sp" />
+        android:textSize="18sp" />
 
     <!--状态图标-->
     <LinearLayout

BIN
android_bed/src/main/h5_3128/res/mipmap-hdpi/bg_main.png


BIN
android_bed/src/main/h5_3128/res/mipmap-mdpi/bg_main.png


BIN
android_bed/src/main/h5_3128/res/mipmap-xhdpi/bg_main.png


+ 20 - 0
android_bed/src/main/h5_3128/res/raw/linphonerc_default

@@ -0,0 +1,20 @@
+[sip]
+contact="Linphone Android" <sip:allen@8.129.220.143>
+use_info=0
+use_ipv6=1
+keepalive_period=30000
+sip_port=-1
+sip_tcp_port=-1
+sip_tls_port=-1
+media_encryption=none
+
+[video]
+size=vga
+
+[app]
+tunnel=disabled
+push_notification=1
+
+[misc]
+max_calls=10
+history_max_size=100

+ 34 - 0
android_bed/src/main/h5_3128/res/raw/linphonerc_factory

@@ -0,0 +1,34 @@
+
+#
+#This file shall not contain path referencing package name, in order to be portable when app is renamed.
+#Paths to resources must be set from LinphoneManager, after creating LinphoneCore.
+[net]
+mtu=1300
+#Because dynamic bitrate adaption can increase bitrate, we must allow "no limit"
+download_bw=0
+upload_bw=0
+force_ice_disablement=0
+
+[sip]
+guess_hostname=1
+register_only_when_network_is_up=1
+auto_net_state_mon=1
+auto_answer_replacing_calls=1
+ping_with_options=0
+use_cpim=1
+
+[video]
+displaytype=MSAndroidTextureDisplay
+
+[misc]
+enable_basic_to_client_group_chat_room_migration=0
+enable_simple_group_chat_message_state=0
+aggregate_imdn=1
+notify_each_friend_individually_when_presence_received=0
+
+[app]
+activation_code_length=4
+prefer_basic_chat_room=1
+
+[assistant]
+xmlrpc_url=https://subscribe.linphone.org:444/wizard.php

+ 1 - 1
build.gradle

@@ -50,7 +50,7 @@ buildscript {
      * FJ-H7_Z_3128_1: 医院版7寸分机
      * ...
      */
-    ext.app_device_type = "fj_h7_z_3128_1"
+    ext.app_device_type = "fj_h5_z_3128_1"
 
     if (app_device_type == "fj_h5_z_3128_1") {
         //rk3128 5寸分机

+ 3 - 0
common/build.gradle

@@ -253,6 +253,9 @@ dependencies {
     compile 'com.google.guava:guava:23.0'
 
     compile project(':resource')
+
+    //linphone sdk
+    compile files('libs/linphone-sdk-android-4.4.33.aar')
 }
 
 //tasks.withType(JavaCompile) {

BIN
common/libs/linphone-sdk-android-4.4.33.aar


+ 1 - 1
common/src/main/code/com/wdkl/ncs/android/lib/utils/EcodeHelper.kt

@@ -68,7 +68,7 @@ class EcodeHelper {
     }
 
     fun createQRImage(content: String, heightPix: Int, logoBm: Bitmap?): Bitmap? {
-        return createQRImage(content, heightPix, logoBm, 1)
+        return createQRImage(content, heightPix, logoBm, 0)
     }
 
     /**

+ 8 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/common/Constant.java

@@ -66,6 +66,7 @@ public class Constant {
 
     //MAC地址
     public static String LOCAL_MAC = "";
+    public static String LOCAL_IP = "";
 
     //设备ID
     public static Integer DEVICE_ID;
@@ -93,6 +94,9 @@ public class Constant {
     //是否开启便民服务
     public static boolean convenientServiceEnabled = false;
 
+    //是否显示护理标题
+    public static int boolDisplayNcTitle = 1;
+
     //科室id
     public static Integer PART_ID;
     public static String PART_NAME = "";
@@ -275,4 +279,8 @@ public class Constant {
     public static final int EVENT_TCP_BREAK = 0x18; //tcp掉线
 
     public static final int EVENT_UPDATE_FEES = 0x19;
+
+    public static final int EVENT_END_CALL = 0x20;
+
+    public static final int SIP_CONNECTED = 0x21;
 }

+ 43 - 109
middleware/src/main/code/com/wdkl/ncs/android/middleware/model/dos/PartSettingDO.java

@@ -7,11 +7,11 @@ import com.wdkl.ncs.android.middleware.model.annotation.Id;
 import com.wdkl.ncs.android.middleware.model.annotation.PrimaryKeyField;
 import com.wdkl.ncs.android.middleware.model.annotation.Table;
 
+import java.io.Serializable;
+
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
-import java.io.Serializable;
-
 @Table(name = "ncs_part_setting")
 @ApiModel
 @JsonNaming(value = PropertyNamingStrategy.SnakeCaseStrategy.class)
@@ -208,52 +208,44 @@ public class PartSettingDO implements Serializable {
     @ApiModelProperty(value = "护士组长转接时长,单位:秒", required = false)
     private Integer transferDurationLeader;
     /**
-     * linux分机的呼出声音音量
-     */
-    @Column(name = "linux_bed_volume_native")
-    @ApiModelProperty(value = "linux分机的呼出声音音量", required = false)
+     *	linux分机的呼出声音音量
+     */	@Column(name = "linux_bed_volume_native" )
+    @ApiModelProperty(value="linux分机的呼出声音音量",required=false)
     private Integer linuxBedVolumeNative;
     /**
-     * linux分机的呼出声音增益
-     */
-    @Column(name = "linux_bed_gain_size")
-    @ApiModelProperty(value = "linux分机的呼出声音增益", required = false)
+     *	linux分机的呼出声音增益
+     */	@Column(name = "linux_bed_gain_size" )
+    @ApiModelProperty(value="linux分机的呼出声音增益",required=false)
     private Integer linuxBedGainSize;
     /**
-     * linux门口机的呼出声音音量
-     */
-    @Column(name = "linux_door_volume_native")
-    @ApiModelProperty(value = "linux门口机的呼出声音音量", required = false)
+     *	linux门口机的呼出声音音量
+     */	@Column(name = "linux_door_volume_native" )
+    @ApiModelProperty(value="linux门口机的呼出声音音量",required=false)
     private Integer linuxDoorVolumeNative;
     /**
-     * linux门口机的呼出声音增益
-     */
-    @Column(name = "linux_door_gain_size")
-    @ApiModelProperty(value = "linux门口机的呼出声音增益", required = false)
+     *	linux门口机的呼出声音增益
+     */	@Column(name = "linux_door_gain_size" )
+    @ApiModelProperty(value="linux门口机的呼出声音增益",required=false)
     private Integer linuxDoorGainSize;
     /**
-     * 安卓分机的呼出声音音量
-     */
-    @Column(name = "android_bed_volume_native")
-    @ApiModelProperty(value = "安卓分机的呼出声音音量", required = false)
+     *	安卓分机的呼出声音音量
+     */	@Column(name = "android_bed_volume_native" )
+    @ApiModelProperty(value="安卓分机的呼出声音音量",required=false)
     private Integer androidBedVolumeNative;
     /**
-     * 安卓分机的呼出声音增益
-     */
-    @Column(name = "android_bed_gain_size")
-    @ApiModelProperty(value = "安卓分机的呼出声音增益", required = false)
+     *	安卓分机的呼出声音增益
+     */	@Column(name = "android_bed_gain_size" )
+    @ApiModelProperty(value="安卓分机的呼出声音增益",required=false)
     private Integer androidBedGainSize;
     /**
-     * 安卓门口机的呼出声音音量
-     */
-    @Column(name = "android_door_volume_native")
-    @ApiModelProperty(value = "安卓门口机的呼出声音音量", required = false)
+     *	安卓门口机的呼出声音音量
+     */	@Column(name = "android_door_volume_native" )
+    @ApiModelProperty(value="安卓门口机的呼出声音音量",required=false)
     private Integer androidDoorVolumeNative;
     /**
-     * 安卓门口机的呼出声音增益
-     */
-    @Column(name = "android_door_gain_size")
-    @ApiModelProperty(value = "安卓门口机的呼出声音增益", required = false)
+     *	安卓门口机的呼出声音增益
+     */	@Column(name = "android_door_gain_size" )
+    @ApiModelProperty(value="安卓门口机的呼出声音增益",required=false)
     private Integer androidDoorGainSize;
 
 
@@ -349,36 +341,20 @@ public class PartSettingDO implements Serializable {
     private String customizeHospitalCallThirdName;
 
     /**
-     * 分机用户名字是否隐藏,0就是不隐藏,1就是隐藏
+     * 用户名字是否隐藏,0就是不隐藏,1就是隐藏
      */
     @Column(name = "customer_name_hidden")
     @ApiModelProperty(value = "用户名字是否隐藏,0就是不隐藏,1就是隐藏", required = false)
     private Integer customerNameHidden;
 
     /**
-     * 分机工作人员名字是否隐藏,0就是不隐藏,1就是隐藏
+     * 工作人员名字是否隐藏,0就是不隐藏,1就是隐藏
      */
     @Column(name = "clerk_name_hidden")
     @ApiModelProperty(value = "工作人员名字是否隐藏,0就是不隐藏,1就是隐藏", required = false)
     private Integer clerkNameHidden;
 
 
-    /**
-     * 门口机用户姓名是否隐藏,0就是不隐藏,1就是隐藏
-     */
-    @Column(name = "customer_name_hidden_on_door")
-    @ApiModelProperty(value = "工作人员名字是否隐藏,0就是不隐藏,1就是隐藏", required = false)
-    private Integer customerNameHiddenOnDoor;
-
-    /**
-     * 门口机工作人员名字是否隐藏,0就是不隐藏,1就是隐藏
-     */
-    @Column(name = "clerk_name_hidden_on_door")
-    @ApiModelProperty(value = "工作人员名字是否隐藏,0就是不隐藏,1就是隐藏", required = false)
-    private Integer clerkNameHiddenOnDoor;
-
-
-
     @Column(name = "doctor_title")
     @ApiModelProperty(value = "模拟分机医生标题", required = true)
     private String doctorTitle;
@@ -489,10 +465,10 @@ public class PartSettingDO implements Serializable {
     private Integer boolAllDoorStatus;
 
     /**
-     * 呼叫时是否开启所有门口机呼显示,0不开启,1开启
+     *	呼叫时是否开启所有门口机呼显示,0不开启,1开启
      */
-    @Column(name = "bool_door_light_always_on")
-    @ApiModelProperty(value = "门灯是否常亮,0否、1是", required = false)
+    @Column(name = "bool_door_light_always_on" )
+    @ApiModelProperty(value="门灯是否常亮,0否、1是",required=false)
     private Integer boolDoorLightAlwaysOn;
 
     @Column(name = "bool_led_service")
@@ -529,28 +505,19 @@ public class PartSettingDO implements Serializable {
     private String iotProductKey;
 
     /**
-     * 是否开启自动定位
-     */
-    @Column(name = "auto_position")
-    @ApiModelProperty(value = "是否开启自动定位", required = false)
+     *	是否开启自动定位
+     */	@Column(name = "auto_position" )
+    @ApiModelProperty(value="是否开启自动定位",required=false)
     private Integer autoPosition;
 
-    /**
-     * 科主任姓名
-     */
-    @Column(name = "part_director")
-    @ApiModelProperty(value = "科主任姓名", required = false)
-    private String partDirector;
 
     /**
-     * 科室护士长
-     */
-    @Column(name = "part_nurse_head")
-    @ApiModelProperty(value = "科室护士长姓名", required = false)
-    private String partNurseHead;
+     *	是否显示护理项标题,1为显示,0为隐藏
+     */	@Column(name = "bool_display_nc_title" )
+    @ApiModelProperty(value="是否显示护理项标题,1为显示,0为隐藏",required=false)
+    private Integer boolDisplayNcTitle;
+
 
-    @ApiModelProperty(value = "是否开启电源线路控制", required = false)
-    private Boolean powerControl;
 
     @PrimaryKeyField
     public Integer getId() {
@@ -1166,7 +1133,6 @@ public class PartSettingDO implements Serializable {
     public void setBoolLedService(Boolean boolLedService) {
         this.boolLedService = boolLedService;
     }
-
     public Integer getBoolDoorLightAlwaysOn() {
         return boolDoorLightAlwaysOn;
     }
@@ -1215,44 +1181,12 @@ public class PartSettingDO implements Serializable {
         this.autoPosition = autoPosition;
     }
 
-    public String getPartDirector() {
-        return partDirector;
-    }
-
-    public void setPartDirector(String partDirector) {
-        this.partDirector = partDirector;
-    }
-
-    public String getPartNurseHead() {
-        return partNurseHead;
-    }
-
-    public void setPartNurseHead(String partNurseHead) {
-        this.partNurseHead = partNurseHead;
-    }
-
-    public Integer getCustomerNameHiddenOnDoor() {
-        return customerNameHiddenOnDoor;
-    }
-
-    public void setCustomerNameHiddenOnDoor(Integer customerNameHiddenOnDoor) {
-        this.customerNameHiddenOnDoor = customerNameHiddenOnDoor;
-    }
-
-    public Integer getClerkNameHiddenOnDoor() {
-        return clerkNameHiddenOnDoor;
-    }
-
-    public void setClerkNameHiddenOnDoor(Integer clerkNameHiddenOnDoor) {
-        this.clerkNameHiddenOnDoor = clerkNameHiddenOnDoor;
-    }
-
-    public Boolean getPowerControl() {
-        return powerControl;
+    public Integer getBoolDisplayNcTitle() {
+        return boolDisplayNcTitle;
     }
 
-    public void setPowerControl(Boolean powerControl) {
-        this.powerControl = powerControl;
+    public void setBoolDisplayNcTitle(Integer boolDisplayNcTitle) {
+        this.boolDisplayNcTitle = boolDisplayNcTitle;
     }
 
     @Override

+ 1 - 1
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClientHandler.java

@@ -44,7 +44,7 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<String> {
         retryTimes = 0;
         Constant.TCP_CONNECTED = true;
         EventBus.getDefault().post(new MessageEvent(1, Constant.EVENT_TCP_STATE));
-        TcpModel tcpModel = DeviceUtil.deviceConnect(Constant.LOCAL_MAC);
+        TcpModel tcpModel = DeviceUtil.deviceConnect(Constant.LOCAL_MAC, Constant.LOCAL_IP);
         TcpClient.getInstance().sendMsg(tcpModel.toJson());
     }
 

+ 2 - 1
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/channel/DeviceUtil.java

@@ -9,7 +9,7 @@ import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction;
 import com.wdkl.ncs.android.middleware.tcp.enums.TcpType;
 
 public class DeviceUtil {
-    public static TcpModel deviceConnect(String mac){
+    public static TcpModel deviceConnect(String mac, String ip){
         TcpModel tcpModel = new TcpModel();
         DeviceConnectDTO connectDTO = new DeviceConnectDTO();
         connectDTO.setIdentification(mac);
@@ -17,6 +17,7 @@ public class DeviceUtil {
         connectDTO.setSoftware_version("V"+ BuildConfig.VERSION_NAME);
         connectDTO.setModel(Build.MODEL);
         connectDTO.setCode(Build.SERIAL);
+        connectDTO.setClientIp(ip);
         tcpModel.setType(TcpType.DEVICE);
         tcpModel.setAction(TcpAction.DeviceAction.CONNECT);
         tcpModel.setData(connectDTO);

+ 11 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/dto/DeviceConnectDTO.java

@@ -31,6 +31,9 @@ public class DeviceConnectDTO implements Serializable {
      */
     private String code;
 
+    /** 客户端Ip **/
+    private String clientIp;
+
     public String getIdentification() {
         return identification;
     }
@@ -70,4 +73,12 @@ public class DeviceConnectDTO implements Serializable {
     public void setCode(String code) {
         this.code = code;
     }
+
+    public String getClientIp() {
+        return clientIp;
+    }
+
+    public void setClientIp(String clientIp) {
+        this.clientIp = clientIp;
+    }
 }

+ 2 - 1
middleware/src/main/code/com/wdkl/ncs/android/middleware/utils/CommonUtils.java

@@ -14,13 +14,14 @@ public class CommonUtils {
     private static final String KEY_SP_SIP_PORT = "KEY_SP_SIP_PORT";
 
     //默认服务器ip端口
-    private static final String DEFAULT_URL = "172.28.100.100";
+    //private static final String DEFAULT_URL = "172.28.100.100";
     //private static final String DEFAULT_URL = "172.17.33.5";  //海外
     //private static final String DEFAULT_URL = "8.129.220.143";
     //private static final String DEFAULT_URL = "119.23.151.229";
     //private static final String DEFAULT_URL = "192.168.9.200";
     //private static final String DEFAULT_URL = "172.18.0.33";  //益阳妇幼
     //private static final String DEFAULT_URL = "192.168.101.1";
+    private static final String DEFAULT_URL = "111.111.0.34";  //祁阳
     private static final String DEFAULT_URL_PORT = "8006";
     private static final String DEFAULT_SIP_PORT = "8188";