Browse Source

分机
增加21。5-3568卓策做为探视分机小推车使用
血糖仪对接代码优化
分机宿舍版本增加 定时熄屏
护士主机 修改了在其他页面呼叫列表显示问题 界面优化
门口机
增加了自定义按键

xunchuanzhi 6 tháng trước cách đây
mục cha
commit
23057b5327
37 tập tin đã thay đổi với 559 bổ sung296 xóa
  1. 16 4
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/AppUpdateActivity.kt
  2. 31 27
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivationActivity.kt
  3. 36 36
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt
  4. 22 23
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedDormitoryActivity.kt
  5. 2 1
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/TextActivity.kt
  6. 3 0
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/bt_gateway/BluetoothService.java
  7. 4 1
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/bt_gateway/DataParse.java
  8. 4 3
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/dialog/Network2DialogHelper.java
  9. 0 1
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/fragment/DormCallRecordsFragment.kt
  10. 3 1
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/HardTools.java
  11. 32 13
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/imp/RK3568ZCHardTools.java
  12. 6 0
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/imp/Z3128HardTools.java
  13. 24 13
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/helper/Util.kt
  14. 3 0
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/helper/Utils.java
  15. 12 11
      android_bed/src/main/res/layout-land/callingbed_test_main.xml
  16. BIN
      android_bed/src/main/res/mipmap-hdpi/hujiao.png
  17. BIN
      android_bed/src/main/res/mipmap-xhdpi/hujiao.png
  18. BIN
      android_bed/src/main/res/mipmap-xxhdpi/hujiao.png
  19. 2 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/CallingHostActivationActivity.kt
  20. 72 77
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHome2Activity.kt
  21. 64 55
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/dorm/DormCallRecordsFragment.kt
  22. 2 2
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/dorm/DromMianFragment.kt
  23. 1 1
      android_host/src/main/res/layout/nurse_main_dorm.xml
  24. BIN
      android_host/src/main/res/mipmap-hdpi/d_main_br.png
  25. 2 1
      app/build.gradle
  26. 13 11
      build.gradle
  27. 2 0
      callingdoor/build.gradle
  28. 131 4
      callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivity.kt
  29. 50 0
      callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/bean/ButtonType.java
  30. 1 1
      callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/helper/SOSHelper.java
  31. 2 0
      common/build.gradle
  32. 12 4
      common/src/main/code/com/wdkl/ncs/android/lib/base/BaseActivity.kt
  33. 1 1
      common/src/main/code/com/wdkl/ncs/android/lib/utils/AppTool.kt
  34. 0 1
      common/src/main/code/com/wdkl/ncs/android/lib/utils/ExtendMethods.kt
  35. 2 0
      middleware/src/main/code/com/wdkl/ncs/android/middleware/common/Constant.java
  36. 3 3
      middleware/src/main/code/com/wdkl/ncs/android/middleware/model/vo/SingDataBean.java
  37. 1 1
      resource/src/main/res/values-zh/strings.xml

+ 16 - 4
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/AppUpdateActivity.kt

@@ -10,6 +10,7 @@ import com.konka.android.tv.XJManager
 import com.wdkl.app.ncs.callingbed.BuildConfig
 import com.wdkl.app.ncs.callingbed.R
 import com.wdkl.app.ncs.callingbed.databinding.UpdateLayBinding
+import com.wdkl.app.ncs.callingbed.hardware.HardWareFactory
 import com.wdkl.app.ncs.callingbed.helper.AppUpdateHelper
 import com.wdkl.app.ncs.callingbed.helper.HttpHelper
 import com.wdkl.app.ncs.callingbed.launch.CallingbedLaunch
@@ -21,11 +22,13 @@ import com.wdkl.ncs.android.middleware.common.Constant
 import com.wdkl.ncs.android.middleware.common.MessageEvent
 import com.wdkl.ncs.android.middleware.logic.contract.callingbed.BedAppUpdateContract
 import com.wdkl.ncs.android.middleware.logic.presenter.callingbed.BedAppUpdatePresenter
+import com.zcapi
 import kotlinx.android.synthetic.main.update_lay.*
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
 import java.io.File
 
+
 @Router(path = "/callingbed/update")
 class AppUpdateActivity :BaseActivity<BedAppUpdatePresenter, UpdateLayBinding>(), BedAppUpdateContract.View {
     private val TAG = "AppUpdateActivity"
@@ -96,7 +99,7 @@ class AppUpdateActivity :BaseActivity<BedAppUpdatePresenter, UpdateLayBinding>()
                 } else if ("YUNPAI_H6".equals(Build.MODEL)) {
                     //中兴8寸分机app升级
                     startInstallAppYunPai()
-                } else if(BuildConfig.flag.equals(Constant.DEV_W_DCH)) {
+                } else if (BuildConfig.flag.equals(Constant.DEV_W_DCH)) {
                     //大朝华7寸分机
                     installApkFordch()
                 } else if (BuildConfig.flag.equals(Constant.DEV_W_YLD)) {
@@ -109,8 +112,11 @@ class AppUpdateActivity :BaseActivity<BedAppUpdatePresenter, UpdateLayBinding>()
                     //a133
                     startInstallA133()
                 } else if (BuildConfig.flag.equals(Constant.DEV_W_RK3288_YM)) {
-                   //rk3288_ym 21.5寸竖屏分机
+                    //rk3288_ym 21.5寸竖屏分机
                     startInstallRk3288Ym()
+                } else if (BuildConfig.flag.equals(Constant.DEV_W_RK3568_ZC)) {
+                    //rk3568_zc 21.5寸探视分机
+                    startInstallRk3568ZC()
                 } else {
                     AppUpdateHelper.installAPK(activity)
                 }
@@ -174,6 +180,12 @@ class AppUpdateActivity :BaseActivity<BedAppUpdatePresenter, UpdateLayBinding>()
         XJManager.getInstance().silentInstall(apkAbsolutePath, this)
     }
 
+    fun startInstallRk3568ZC() {
+        val apkAbsolutePath = AppUpdateHelper.FILE_APK_PATH + "/" + AppUpdateHelper.FILE_APK_NAME
+        HardWareFactory.getHardTools().startInstall(apkAbsolutePath)
+
+    }
+
     //云派8寸机app静默升级
     fun startInstallAppYunPai() {
         val apkAbsolutePath = AppUpdateHelper.FILE_APK_PATH + "/" + AppUpdateHelper.FILE_APK_NAME
@@ -244,9 +256,9 @@ class AppUpdateActivity :BaseActivity<BedAppUpdatePresenter, UpdateLayBinding>()
     override fun networkMonitor(state: NetState) {
         state.filter(onMobile = {
 
-        },onWifi = {
+        }, onWifi = {
 
-        },offline = {
+        }, offline = {
 
         })
     }

+ 31 - 27
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivationActivity.kt

@@ -359,34 +359,38 @@ class CallingbedActivationActivity  : BaseActivity<CallingbedActivationPresenter
 
     private fun checkServer() {
         //更多权限认证
-        var allow = 0
-        if (!Settings.System.canWrite(this)) {
-            allow++
-            val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
-            intent.data = Uri.parse("package:" + this.packageName)
-            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
-            startActivityForResult(intent, 110)
-        }
-
-        if (!Settings.canDrawOverlays(this)) {
-            allow++
-            val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
-                Uri.parse("package:$packageName"))
-            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
-            startActivityForResult(intent, 111)
-        }
 
-        val notificationManager = this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !notificationManager.isNotificationPolicyAccessGranted()) {
-            allow++
-            val intent = Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS)
-            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
-            startActivityForResult(intent, 112)
-        }
+          if (BuildConfig.flag.equals(Constant.DEV_W_ZX_8)){
+                      var allow = 0
+                      if (!Settings.System.canWrite(this)) {
+                          allow++
+                          val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
+                          intent.data = Uri.parse("package:" + this.packageName)
+                          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                          startActivityForResult(intent, 110)
+                      }
+
+                      if (!Settings.canDrawOverlays(this)) {
+                          allow++
+                          val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
+                                  Uri.parse("package:$packageName"))
+                          intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+                          startActivityForResult(intent, 111)
+                      }
+
+                      val notificationManager = this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+                      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !notificationManager.isNotificationPolicyAccessGranted()) {
+                          allow++
+                          val intent = Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS)
+                          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                          startActivityForResult(intent, 112)
+                      }
+
+                      if (allow > 0) {
+                          return
+                      }
+          }
 
-        if (allow > 0) {
-            return
-        }
 
         if (SettingConfig.getOfflineModeRunning(activity)) {
             Log.e(TAG, "goto offline mode...")
@@ -730,7 +734,7 @@ class CallingbedActivationActivity  : BaseActivity<CallingbedActivationPresenter
         }
         if (status==">") {
             //发送sos消息
-            SerialPortUtilLoar.getInstance().sendSOS( Constant.DEVICE_REGISTER_ID)
+            SerialPortUtilLoar.getInstance().sendSOS(Constant.DEVICE_REGISTER_ID)
         }
 
     }

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

@@ -1,6 +1,5 @@
 package com.wdkl.app.ncs.callingbed.activity
 
-import android.bluetooth.BluetoothAdapter
 import android.bluetooth.BluetoothGatt
 import android.bluetooth.BluetoothGattCharacteristic
 import android.content.*
@@ -36,7 +35,6 @@ import com.google.gson.Gson
 import com.google.gson.reflect.TypeToken
 import com.jni.JniClient
 import com.konka.android.tv.XJManager
-import com.tmall.wireless.tangram.util.LogUtils
 import com.wdkl.app.ncs.callingbed.Bean.ButtonType
 import com.wdkl.app.ncs.callingbed.BuildConfig
 import com.wdkl.app.ncs.callingbed.R
@@ -442,20 +440,20 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                 disconnectTimes = 3
                 //发送设备离线udp通知护士主机
                 UdpSendUtil.getInstance().sendUdpData(
-                    UdpIndex.DEVICE_OFFLINE,
-                    Constant.BED_NAME,
-                    "",
-                    Constant.FJ_NAME,
-                    Constant.DEVICE_REGISTER_ID,
-                    "",
-                    "",
-                    "",
-                    "",
-                    "",
-                    "",
-                    Constant.DEVICE_ID,
-                    -1,
-                    Constant.PART_ID
+                        UdpIndex.DEVICE_OFFLINE,
+                        Constant.BED_NAME,
+                        "",
+                        Constant.FJ_NAME,
+                        Constant.DEVICE_REGISTER_ID,
+                        "",
+                        "",
+                        "",
+                        "",
+                        "",
+                        "",
+                        Constant.DEVICE_ID,
+                        -1,
+                        Constant.PART_ID
                 )
             }
         }
@@ -504,12 +502,17 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
     private fun startCallActivity(callIntent: Intent) {
         //关闭其他页面
         EventBus.getDefault().post(MessageEvent("finish", Constant.EVENT_FINISHh))
-
-        if (!mainFragment.equals(curFragment)) {
+        if (BuildConfig.device_type.equals("3")) {
+             if (!apartmentFragment.equals(curFragment)) {
+                 switchFragment(R.id.callingbed_main_frame, ApartmentFragment(), apartmentFragment)
+                 updateLeftBtState(apartmentFragment)
+        }
+        }else{
+            if (!mainFragment.equals(curFragment)) {
             switchFragment(R.id.callingbed_main_frame, MainFragment(), mainFragment)
             updateLeftBtState(mainFragment)
         }
-
+        }
         //启动呼叫activity
         startActivity(callIntent)
     }
@@ -881,6 +884,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
             if (BuildConfig.flag == Constant.DEV_W_YLD
                 || BuildConfig.flag == Constant.DEV_W_DCH
                 || BuildConfig.flag == Constant.DEV_W_ZX_8
+                    || BuildConfig.flag == Constant.DEV_W_RK3568_ZC
             ) {
                 presenter.getAppVersion(Constant.PART_ID, 104)
             } else {
@@ -1964,7 +1968,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                             //紧急呼叫已处理
                             SOSHelper.sosStop()
                         }
-                    }else if (tcpModel.type == TcpType.AUTH) {
+                    } else if (tcpModel.type == TcpType.AUTH) {
                         if (tcpModel.action == TcpAction.AuthAction.LOGIN) {
                             val json = JSONObject.parseObject(tcpModel.data.toString())
                             val auth_id = json.getString("id")
@@ -2180,8 +2184,8 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                             if (tcpModel.action == TcpAction.REMOTEVISITAction.CALL) {
                                 var channelName = tcpModel.data.toString()
                                 //确保探视tcp正常且房间号不为空,呼叫状态为待机中
-                                if (Constant.TCP_CONNECTED && !TextUtils.isEmpty(channelName) && Constant.CALL_STATE==Constant.CALL_STANDBY) {
-                                     if (playing) {
+                                if (Constant.TCP_CONNECTED && !TextUtils.isEmpty(channelName) && Constant.CALL_STATE == Constant.CALL_STANDBY) {
+                                    if (playing) {
                                         stopBroadcast(false)
                                     }
                                     if (Constant.NursingTitle.equals(getString(R.string.enter_nursing))) {
@@ -2200,10 +2204,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                                         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                                         startCallActivity(intent)
                                     }
-                                }else{
+                                } else {
                                     showMessage(R.string.call_init_error)
                                     Constant.CALL_STATE = Constant.CALL_STANDBY
-                                    val rejectTcp = SwVisitUtil.BedvisitIngCall( channelName)
+                                    val rejectTcp = SwVisitUtil.BedvisitIngCall(channelName)
                                     TcpClient.getInstance().sendMsg(rejectTcp.toJson())
                                 }
 
@@ -2857,7 +2861,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                     showMessage(R.string.wait_moment)
                 }
             } else if (intent.action == Constant.HOOK_ON) {
-                Log.e(TAG,"手柄放下 ")
+                Log.e(TAG, "手柄放下 ")
                 Constant.hookOn = true
                 VoiceManagerUtil.switchAudioMode(activity, true)
                 if (System.currentTimeMillis() - clickCallTime > 2000) {
@@ -2875,7 +2879,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
 
                 clickCallTime = System.currentTimeMillis()
             } else if (intent.action == Constant.HOOK_OFF) {
-                Log.e(TAG,"手柄拿起 ")
+                Log.e(TAG, "手柄拿起 ")
                 Constant.hookOn = false
                 VoiceManagerUtil.switchAudioMode(activity, false)
                 if (System.currentTimeMillis() - clickCallTime > 2000) {
@@ -3040,7 +3044,6 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                                                                         if (testValueData.contains("04") || testValueData.contains("0e")) {
                                                                             if (testValueData.substring(10, 12) == "04") { //04代表当前测试值
                                                                                 testValueData = testValueData.substring(24, 28) //看协议对应位置
-
                                                                                 //随机数
                                                                                 val numcode = ((Math.random() * 9 + 1) * 1000).toInt()
                                                                                 //12FF10FFF3000001007b0100004ce173c4ccec  //测试数值 注意最后六位是Mac
@@ -3050,14 +3053,11 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                                                                                 return@Runnable
                                                                             } else if (testValueData.substring(10, 12) == "0e") { //0e代表历史记录数据
                                                                                 //历史数据暂时不要 不上传
-                                                                                //                                                                                    testValueData = testValueData.substring(28, 32);//看协议对应位置
-                                                                                //////                                                                                   //随机数
-                                                                                //                                                                                    int numcode = (int) ((Math.random() * 9 + 1) * 1000);
-                                                                                ////                                                                                     //12FF10FFF3000001007b0100004ce173c4ccec  //测试数值 注意最后六位是Mac
-                                                                                //                                                                                    String data = "12FF10FFF300" + numcode + testValueData + "010000" + (bleDevice.getMac()).replace(":", "");
-                                                                                ////                                                                                      //发数据
-                                                                                //                                                                                    serviceBinder.setdata(data);
-                                                                                //                                                                                    return;
+//                                                                                testValueData = testValueData.substring(28, 32)//看协议对应位置
+//                                                                                val numcode = ((Math.random() * 9 + 1) * 1000).toInt()
+//                                                                                val data = "12FF10FFF300" + numcode + testValueData + "010000" + bleDevice.mac.replace(":", "")
+//                                                                                btServiceBinder!!.setData(data)
+//                                                                                return@Runnable
                                                                             }
                                                                         }
                                                                     } else {
@@ -3360,7 +3360,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
         }else if (keyCode==135){
             //大成慧康
             //手电筒
-            Log.d(TAG, "手电筒code--" + keyCode+"   "+lamp.toString())
+            Log.d(TAG, "手电筒code--" + keyCode + "   " + lamp.toString())
           if(!lamp){
               lamp=true
             JniClient.switchLed(6, 1)

+ 22 - 23
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedDormitoryActivity.kt

@@ -289,7 +289,7 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
 //        Utils.setStatusBarDisable(activity, Utils.STATUS_BAR_DISABLE_EXPAND)
 //
 //        //保持屏幕常亮
-//        AppTool.Setting.setScreenOffTimeOut(applicationContext, 35000)
+        AppTool.Setting.setScreenOffTimeOut(applicationContext, 5)
 
         presenter.loadServerInfo()
 
@@ -879,9 +879,6 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
 
     /**
      * 设置 按钮功能
-     * */
-    /**
-     * 设置 按钮功能
      */
     fun setButtonType(status: String?) {
         if (Constant.device_button_function.isNullOrEmpty()) {
@@ -955,9 +952,11 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
         if (currentTime - clickTime > 3000) {
             if (Constant.TCP_CONNECTED) {
                 if (Constant.DEVICE_ID != -1) {
-                    OtherUtil.sendReinforce(Constant.DEVICE_ID)
-                    ReinforcementsDialogHelper.showDialog(activity, 1)
-                    SoundPoolManager.getInstance().playSound(4, 1.0f, 1.0f, 0)
+                    runOnUiThread {
+                        OtherUtil.sendReinforce(Constant.DEVICE_ID)
+                        ReinforcementsDialogHelper.showDialog(activity, 1)
+                        SoundPoolManager.getInstance().playSound(4, 1.0f, 1.0f, 0)
+                    }
                 } else {
                     showMessage("null device id!")
                 }
@@ -1057,7 +1056,7 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             return
         }
 
-        if (Constant.CUSTOM_ID != -1) {
+//        if (Constant.CUSTOM_ID != -1) {
             if (playing) {
                 stopBroadcast(true)
             }
@@ -1083,9 +1082,9 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             } else {
                 showMessage(R.string.call_init_error)
             }
-        } else {
-            showMessage(R.string.custom_empty)
-        }
+//        } else {
+//            showMessage(R.string.custom_empty)
+//        }
     }
 
     //开始角色呼叫
@@ -1094,7 +1093,7 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             showMessage(R.string.device_disable)
             return
         }
-        if (Constant.CUSTOM_ID != -1) {
+//        if (Constant.CUSTOM_ID != -1) {
             if (playing) {
                 stopBroadcast(true)
             }
@@ -1123,9 +1122,9 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             } else {
                 showMessage(R.string.call_init_error)
             }
-        } else {
-            showMessage(R.string.custom_empty)
-        }
+//        } else {
+//            showMessage(R.string.custom_empty)
+//        }
     }
 
     fun startCallRoleName(roleType: String) {
@@ -1134,7 +1133,7 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             return
         }
 
-        if (Constant.CUSTOM_ID != -1) {
+//        if (Constant.CUSTOM_ID != -1) {
             if (playing) {
                 stopBroadcast(true)
             }
@@ -1167,9 +1166,9 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             } else {
                 showMessage(R.string.call_init_error)
             }
-        } else {
-            showMessage(R.string.custom_empty)
-        }
+//        } else {
+//            showMessage(R.string.custom_empty)
+//        }
     }
 
     fun startCallDevice(deviceId: Int) {
@@ -1178,7 +1177,7 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             return
         }
 
-        if (Constant.CUSTOM_ID != -1) {
+//        if (Constant.CUSTOM_ID != -1) {
             if (playing) {
                 stopBroadcast(true)
             }
@@ -1209,9 +1208,9 @@ class CallingbedDormitoryActivity :BaseActivity<BedCallingbedActivityPresenter,
             } else {
                 showMessage(R.string.call_init_error)
             }
-        } else {
-            showMessage(R.string.custom_empty)
-        }
+//        } else {
+//            showMessage(R.string.custom_empty)
+//        }
     }
 
     @Subscribe(threadMode = ThreadMode.MAIN)

+ 2 - 1
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/TextActivity.kt

@@ -114,7 +114,7 @@ class TextActivity : BaseActivity<BedTextActivityPresenter, CallingbedTestMainBi
                 //
             }
         }
-        sos_button.setOnClickListener {
+        loar_button.setOnClickListener {
             finish()
             val intent = Intent()
             intent.setClass(activity, AppTextActivity::class.java)
@@ -150,6 +150,7 @@ class TextActivity : BaseActivity<BedTextActivityPresenter, CallingbedTestMainBi
         lycs_img.visibility=View.INVISIBLE
         if (BuildConfig.FLAVOR.equals("rk3128")){
             text_ll_2.visibility =View.GONE
+            loar_button.text = "其他测试"
         }else if (BuildConfig.FLAVOR.equals("dch_7")){
             text_ll_4.visibility =View.GONE
         }

+ 3 - 0
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/bt_gateway/BluetoothService.java

@@ -428,6 +428,9 @@ public class BluetoothService extends Service implements BeaconConsumer, SocketC
      */
     public void sendData(final String data) {
         if (baxcSocketConnectLine != null) {
+            if (dataCallback != null) {
+                dataCallback.onData(data);
+            }
             new Thread(new Runnable() {
                 @Override
                 public void run() {

+ 4 - 1
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/bt_gateway/DataParse.java

@@ -71,7 +71,10 @@ public class DataParse {
             case "f3": // 这是血糖的数据
                 String valStr = Long.parseLong(result.substring(16, 20), 16) + "";
                 if (valStr.length() > 4) {
-                    return null;
+                    signData.type =3;
+                    signData.bloodGlucose = 0;
+                    Log.d(TAG, "血糖为" + signData.bloodGlucose);
+                    return signData;
                 }
                 int dw = Integer.parseInt(result.substring(21, 22));
                 double value = Double.parseDouble(valStr.substring(0, (valStr.length() - dw)) + "." + valStr.substring(valStr.length() - dw));

+ 4 - 3
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/dialog/Network2DialogHelper.java

@@ -14,11 +14,13 @@ import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.wdkl.app.ncs.callingbed.BuildConfig;
 import com.wdkl.app.ncs.callingbed.R;
 import com.wdkl.app.ncs.callingbed.helper.NetHelper;
 import com.wdkl.app.ncs.callingbed.helper.Utils;
 import com.wdkl.ncs.android.lib.utils.EthernetUtils;
 import com.wdkl.ncs.android.lib.utils.NetParam;
+import com.wdkl.ncs.android.middleware.common.Constant;
 //import com.wdkl.ncs.android.lib.utils.EthernetUtils;
 
 import static com.wdkl.ncs.android.lib.utils.ExtendMethodsKt.showMessage;
@@ -79,12 +81,11 @@ public class Network2DialogHelper {
                     showMessage(R.string.param_set_error);
                 }
                 alertDialog.dismiss();
-
                 //设置静态网络
                 if (EthernetUtils.setEthernetStaticIp(activity,IP,ym,wg,dns)) {
-                    showMessage("Success");
+                         showMessage("Success");
                 } else {
-                    showMessage("Failed");
+                         showMessage("Failed");
                 }
             }
         });

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

@@ -78,7 +78,6 @@ class DormCallRecordsFragment : BaseFragment<BedCallRecordsFragmentPresenter, Do
 
     override fun onResume() {
         super.onResume()
-
         if (Constant.CUSTOM_ID != -1) {
             presenter.loadCallRecords(page, pageSize, Constant.CUSTOM_ID)
         }

+ 3 - 1
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/HardTools.java

@@ -37,7 +37,7 @@ public  class HardTools {
     public void setSOSStop(){}
     //门灯颜色
     public void setDoorLight(int type){}
-    //重置设备
+    //重
     public void resetDevice(){}
     //重置设备 XCrashUtils
     public void resetDevicex(Application application){}
@@ -55,6 +55,8 @@ public  class HardTools {
 
     public void initNFC(){}
 
+    public void startInstall(String apkAbsolutePath){}
+
     //提供卡号
     public  void offerCardData(String data){}
     //提供按键数据

+ 32 - 13
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/imp/RK3568ZCHardTools.java

@@ -15,6 +15,7 @@ import com.wdkl.app.ncs.callingbed.helper.AppUpdateHelper;
 import com.wdkl.app.ncs.callingbed.helper.NetHelper;
 import com.wdkl.ncs.android.lib.base.BaseApplication;
 import com.wdkl.ncs.android.middleware.common.Constant;
+import com.wdkl.ncs.android.middleware.utils.AppUtil;
 import com.zcapi;
 
 import java.util.Calendar;
@@ -25,7 +26,7 @@ import java.util.List;
  * */
 public class RK3568ZCHardTools extends HardTools {
 
-    zcapi zcApi;
+    public zcapi zcApi;
     private static class RK3288YMHardToolsHolder{
         private final  static RK3568ZCHardTools cHardTools = new RK3568ZCHardTools();
     }
@@ -47,7 +48,7 @@ public class RK3568ZCHardTools extends HardTools {
 
     @Override
     public void resetDevice() {
-
+        zcApi.reboot();
     }
     @Override
     public void setTime(Context context, long timeMills, String timeZone) {
@@ -55,11 +56,12 @@ public class RK3568ZCHardTools extends HardTools {
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(new Date(timeMills));
             int year = calendar.get(Calendar.YEAR);
-            int month = calendar.get(Calendar.MONTH);
+            int month = calendar.get(Calendar.MONTH)+1;
             int day = calendar.get(Calendar.DAY_OF_MONTH);
             int hour = calendar.get(Calendar.HOUR_OF_DAY);
             int minute = calendar.get(Calendar.MINUTE);
             int[] timeArray = new int[] { year, month, day, hour, minute, 0 };
+            Log.d("wdkl_app", "timeArray " +  year+month+day+hour+minute);
             zcApi.setSystemTime(timeArray);
         }
         super.setTime(context, timeMills, timeZone);
@@ -73,7 +75,7 @@ public class RK3568ZCHardTools extends HardTools {
         //获取mac地址
         Constant.LOCAL_MAC = NetHelper.getInstance().getMacAddress();
         Constant.DEVICE_SN = zcApi.getBuildSerial();
-
+        Log.d("wdkl_app", "Constant.DEVICE_SN: " +  Constant.DEVICE_SN);
         if (!TextUtils.isEmpty(Constant.DEVICE_SN) && !Constant.DEVICE_SN.equalsIgnoreCase("null")) {
             Constant.DEVICE_REGISTER_ID = Constant.DEVICE_SN;
         } else {
@@ -83,22 +85,30 @@ public class RK3568ZCHardTools extends HardTools {
 
     @Override
     public void startbar(Boolean showBar) {
-        zcApi.setStatusBar(!showBar);
+        zcApi.setStatusBar(showBar);
         super.startbar(showBar);
     }
 
     @Override
-    public void uninstallApp(Context context, boolean isuninstall, String name) {
-
+    public void startInstall(String apkAbsolutePath) {
+        zcApi.InstallApk(apkAbsolutePath,true);
+        super.startInstall(apkAbsolutePath);
     }
 
     @Override
-    public void installApk(AppUpdateActivity context) {
-    }
-
-    @Override
-    public void startInstallApk(AppUpdateActivity context) {
-
+    public void uninstallApp(Context context, boolean isuninstall, String name) {
+        //卸载原来二代系统apk
+        if (isuninstall) {
+            Thread thread = new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    // 在子线程中执行的代码
+                    if (checkAppExist(context,name)) {
+                        AppUtil.uninstallApp(name);
+                    }
+                }
+            });
+        }
     }
 
     private boolean checkAppExist(Context context, String name) {
@@ -114,4 +124,13 @@ public class RK3568ZCHardTools extends HardTools {
         Log.e("wdkl_app", "callingdoor app exist: " + appExist);
         return appExist;
     }
+    @Override
+    public void installApk(AppUpdateActivity context) {
+    }
+
+    @Override
+    public void startInstallApk(AppUpdateActivity context) {
+
+    }
+
 }

+ 6 - 0
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/imp/Z3128HardTools.java

@@ -1,7 +1,10 @@
 package com.wdkl.app.ncs.callingbed.hardware.imp;
 
+import android.app.AlarmManager;
 import android.app.Application;
+import android.app.PendingIntent;
 import android.content.Context;
+import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.provider.Settings;
@@ -18,6 +21,7 @@ import com.wdkl.app.ncs.callingbed.helper.NetHelper;
 import com.wdkl.app.ncs.callingbed.helper.SOSHelper;
 import com.wdkl.app.ncs.callingbed.helper.SerialPortHelper;
 import com.wdkl.app.ncs.callingbed.settings.SettingConfig;
+import com.wdkl.ncs.android.component.welcome.activity.WelcomeActivity;
 import com.wdkl.ncs.android.lib.utils.AppTool;
 import com.wdkl.ncs.android.middleware.common.Constant;
 import com.wdkl.ncs.android.middleware.utils.AppUtil;
@@ -181,4 +185,6 @@ public class Z3128HardTools extends HardTools {
     }
 
 
+
+
 }

+ 24 - 13
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/helper/Util.kt

@@ -7,7 +7,10 @@ import android.content.Context.KEYGUARD_SERVICE
 import android.os.PowerManager
 import android.util.DisplayMetrics
 import android.view.WindowManager
+import com.wdkl.app.ncs.callingbed.BuildConfig
 import com.wdkl.ncs.android.lib.base.BaseApplication
+import com.wdkl.ncs.android.middleware.common.Constant
+import com.zcapi
 
 
 object Util {
@@ -17,22 +20,30 @@ object Util {
      */
     @SuppressLint("InvalidWakeLockTag")
     fun wakeUpAndUnlock(): PowerManager.WakeLock? {
-        val pm = BaseApplication.appContext.getSystemService(Context.POWER_SERVICE) as PowerManager
-        var wakeLock: PowerManager.WakeLock? = null
+        if (!BuildConfig.flag.equals(Constant.DEV_W_RK3568_ZC)){
+            val pm = BaseApplication.appContext.getSystemService(Context.POWER_SERVICE) as PowerManager
+            var wakeLock: PowerManager.WakeLock? = null
 
-        val screenOn = pm.isInteractive
-        if (!screenOn) { //如果是熄灭状态
-            wakeLock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP or PowerManager.SCREEN_DIM_WAKE_LOCK, "TAG")
-            wakeLock.acquire(10000)//亮屏
+            val screenOn = pm.isInteractive
+            if (!screenOn) { //如果是熄灭状态
+                wakeLock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP or PowerManager.SCREEN_DIM_WAKE_LOCK, "TAG")
+                wakeLock.acquire(10000)//亮屏
+            }
+
+            // 屏幕解锁
+            val keyguardManager = BaseApplication.appContext.getSystemService(KEYGUARD_SERVICE) as KeyguardManager
+            val keyguardLock = keyguardManager.newKeyguardLock("unLock")
+            // 屏幕锁定
+            keyguardLock.reenableKeyguard()
+            keyguardLock.disableKeyguard() // 解锁
+            return wakeLock
+        }else{
+            val zcApi = zcapi()
+            zcApi.getContext(BaseApplication.appContext)
+            zcApi.setLcdOnOff(true)
         }
+        return null
 
-        // 屏幕解锁
-        val keyguardManager = BaseApplication.appContext.getSystemService(KEYGUARD_SERVICE) as KeyguardManager
-        val keyguardLock = keyguardManager.newKeyguardLock("unLock")
-        // 屏幕锁定
-        keyguardLock.reenableKeyguard()
-        keyguardLock.disableKeyguard() // 解锁
-        return wakeLock
     }
 
     @SuppressLint("InvalidWakeLockTag")

+ 3 - 0
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/helper/Utils.java

@@ -10,6 +10,7 @@ import android.util.Log;
 import android.view.inputmethod.InputMethodManager;
 
 import com.wdkl.app.ncs.callingbed.BuildConfig;
+import com.wdkl.app.ncs.callingbed.hardware.HardWareFactory;
 import com.wdkl.ncs.android.lib.base.BaseApplication;
 import com.wdkl.ncs.android.middleware.common.Constant;
 
@@ -72,6 +73,8 @@ public class Utils {
             } catch (Exception e) {
                 //
             }
+        }else {
+            HardWareFactory.getHardTools().startbar(hide);
         }
     }
 

+ 12 - 11
android_bed/src/main/res/layout-land/callingbed_test_main.xml

@@ -220,28 +220,27 @@
 
 
 
+
                 <LinearLayout
-                    android:id="@+id/text_ll_6"
+                    android:id="@+id/text_ll_5"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="@dimen/d16"
-                    android:clickable="true"
                     android:gravity="center"
                     android:orientation="horizontal">
 
                     <Button
-                        android:id="@+id/loar_button"
+                        android:id="@+id/sos_button"
                         android:layout_width="@dimen/d383"
                         android:layout_height="@dimen/d48"
                         android:background="@drawable/shape_main_hos_txt_bg"
-                        android:clickable="true"
                         android:gravity="center"
-                        android:text="loar信号测试"
+                        android:text="@string/test_sos_button"
                         android:textColor="@drawable/selector_bottom_btn_text_color"
                         android:textSize="16sp" />
 
                     <ImageView
-                        android:id="@+id/loar_img"
+                        android:id="@+id/sos_img"
                         android:layout_width="@dimen/d16"
                         android:layout_height="@dimen/d16"
                         android:layout_marginLeft="@dimen/d8"
@@ -279,33 +278,35 @@
                         android:background="@mipmap/gou"
                         android:visibility="invisible" />
                 </LinearLayout>
+
                 <LinearLayout
-                    android:id="@+id/text_ll_5"
+                    android:id="@+id/text_ll_6"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="@dimen/d16"
+                    android:clickable="true"
                     android:gravity="center"
                     android:orientation="horizontal">
 
                     <Button
-                        android:id="@+id/sos_button"
+                        android:id="@+id/loar_button"
                         android:layout_width="@dimen/d383"
                         android:layout_height="@dimen/d48"
                         android:background="@drawable/shape_main_hos_txt_bg"
+                        android:clickable="true"
                         android:gravity="center"
-                        android:text="@string/test_sos_button"
+                        android:text="loar信号测试"
                         android:textColor="@drawable/selector_bottom_btn_text_color"
                         android:textSize="16sp" />
 
                     <ImageView
-                        android:id="@+id/sos_img"
+                        android:id="@+id/loar_img"
                         android:layout_width="@dimen/d16"
                         android:layout_height="@dimen/d16"
                         android:layout_marginLeft="@dimen/d8"
                         android:background="@mipmap/gou"
                         android:visibility="invisible" />
                 </LinearLayout>
-
             </LinearLayout>
 
         </LinearLayout>

BIN
android_bed/src/main/res/mipmap-hdpi/hujiao.png


BIN
android_bed/src/main/res/mipmap-xhdpi/hujiao.png


BIN
android_bed/src/main/res/mipmap-xxhdpi/hujiao.png


+ 2 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/CallingHostActivationActivity.kt

@@ -138,6 +138,8 @@ class CallingHostActivationActivity : BaseActivity<DevicePresenter, CallinghostA
                 Constant.hospital_name = deviceInfo!!.hospitalName
                 Constant.part_name = deviceInfo!!.partName
                 Constant.partDisplay = deviceInfo!!.partDisplay
+
+
                 Constant.PART_ID = deviceInfo!!.partId
                 Constant.DEVICE_ID = deviceInfo!!.id
                 Constant.SIP_ID = deviceInfo!!.sipId

+ 72 - 77
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHome2Activity.kt

@@ -7,14 +7,10 @@ import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
-import android.graphics.Color
 import android.net.ConnectivityManager
 import android.net.Uri
 import android.net.wifi.WifiManager
-import android.os.BatteryManager
-import android.os.Build
-import android.os.Bundle
-import android.os.Environment
+import android.os.*
 import android.provider.Settings
 import android.text.TextUtils
 import android.util.Log
@@ -32,22 +28,18 @@ import com.google.common.base.Strings
 import com.google.gson.Gson
 import com.wdkl.ncs.android.component.nursehome.BuildConfig
 import com.wdkl.ncs.android.component.nursehome.R
-import com.wdkl.ncs.android.component.nursehome.databinding.ActivityNewNurseHomeBinding
 import com.wdkl.ncs.android.component.nursehome.databinding.NurseMainDormBinding
 import com.wdkl.ncs.android.component.nursehome.dorm.*
 import com.wdkl.ncs.android.component.nursehome.fragment.*
 import com.wdkl.ncs.android.component.nursehome.hardware.HardWareFactroy
 import com.wdkl.ncs.android.component.nursehome.helper.SoundPoolManager
 import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
-import com.wdkl.ncs.android.component.nursehome.led.LedItem
 import com.wdkl.ncs.android.component.nursehome.led.LedManagerUtils
 import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
 import com.wdkl.ncs.android.component.nursehome.sip.callback.PhoneCallback
 import com.wdkl.ncs.android.component.nursehome.sip.core.LinphoneManager
 import com.wdkl.ncs.android.component.nursehome.util.*
 import com.wdkl.ncs.android.component.nursehome.visit.frgment.VisitCallFragment
-import com.wdkl.ncs.android.component.nursehome.visit.frgment.VisitMainFragment
-import com.wdkl.ncs.android.component.nursehome.visit.frgment.VisitSetFragment
 import com.wdkl.ncs.android.component.nursehome.visit.tcp.VisitTcpClient
 import com.wdkl.ncs.android.component.nursehome.window.ImPlayDialogHelper
 import com.wdkl.ncs.android.component.nursehome.window.IncidentWindow
@@ -55,13 +47,9 @@ import com.wdkl.ncs.android.component.nursehome.window.IncidentWindow2
 import com.wdkl.ncs.android.lib.base.BaseActivity
 import com.wdkl.ncs.android.lib.base.BaseApplication
 import com.wdkl.ncs.android.lib.core.locale.LocaleMangerUtils
-import com.wdkl.ncs.android.lib.core.locale.SettingConfigNew
 import com.wdkl.ncs.android.lib.utils.*
 import com.wdkl.ncs.android.middleware.common.Constant
 import com.wdkl.ncs.android.middleware.common.MessageEvent
-import com.wdkl.ncs.android.middleware.common.SipStatus
-import com.wdkl.ncs.android.middleware.dao.DaoManager
-import com.wdkl.ncs.android.middleware.dao.entity.LedDeviceInfoBean
 import com.wdkl.ncs.android.middleware.entity.BringItem
 import com.wdkl.ncs.android.middleware.entity.CallingItem
 import com.wdkl.ncs.android.middleware.logic.contract.nursehome.NurseHomeActivityContract
@@ -90,7 +78,6 @@ import com.wdkl.ncs.android.middleware.utils.StringUtil
 import com.wdkl.ncs.janus.util.JanusConstant
 import kotlinx.android.synthetic.main.nurse_main_dorm.*
 import kotlinx.android.synthetic.main.view_title_layout.*
-import kotlinx.android.synthetic.main.view_title_layout.view_title_layout_iv_sip
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -98,14 +85,12 @@ import org.linphone.core.Call
 import org.linphone.core.RegistrationState
 import org.linphone.core.TransportType
 import serialporttest.utils.SerialPortUtilHost
-import java.io.File
-import java.io.FileOutputStream
-import java.io.PrintWriter
 import java.util.*
 import java.util.concurrent.Executors
 import java.util.concurrent.ScheduledExecutorService
 import java.util.concurrent.TimeUnit
 import kotlin.collections.ArrayList
+
 /**/
 
 /**
@@ -171,8 +156,8 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
         var brIngList = ArrayList<BringItem>()
 
         // 添加字符串到 brIngList 中
-        fun addTobrIngList(id: String,bid: String) {
-            val item =  BringItem(bid,id)
+        fun addTobrIngList(id: String, bid: String) {
+            val item =  BringItem(bid, id)
             brIngList.add(item)
         }
 
@@ -514,10 +499,10 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                 switchFragment(R.id.callingbed_main_frame, WorkFragment(), WorkFragment)
             }
         }
-        //iot设备
+        //广播
         dorm_iot_but.setOnClickListener {
-            if (!SystemSettingsFragment.equals(curFragment)) {
-                switchFragment(R.id.callingbed_main_frame, IotDeviceFragment(), IotDeviceFragment)
+            if (!BroadcastNewFragment.equals(curFragment)) {
+                switchFragment(R.id.callingbed_main_frame, BroadcastNewFragment(), BroadcastNewFragment)
             }
         }
 
@@ -530,6 +515,7 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
         }
     }
 
+
     fun showThemeSet() {
         if (!dormThemeFragment.equals(curFragment)) {
             switchFragment(R.id.callingbed_main_frame, DormThemeFragment(), dormThemeFragment)
@@ -928,20 +914,20 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
 
             //通知设备切换在线模式
             UdpSendUtil.getInstance().sendUdpData(
-                UdpIndex.SERVER_MODE_ONLINE,
-                Constant.part_name,
-                "",
-                "",
-                Constant.DEVICE_REGISTER_ID,
-                "",
-                "",
-                "",
-                "",
-                "",
-                "",
-                Constant.DEVICE_ID,
-                -1,
-                Constant.PART_ID
+                    UdpIndex.SERVER_MODE_ONLINE,
+                    Constant.part_name,
+                    "",
+                    "",
+                    Constant.DEVICE_REGISTER_ID,
+                    "",
+                    "",
+                    "",
+                    "",
+                    "",
+                    "",
+                    Constant.DEVICE_ID,
+                    -1,
+                    Constant.PART_ID
             )
         }
     }
@@ -1078,8 +1064,8 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                                 frameName = item.interactionVO.fromFrameFullName.replace("-", "")
                             }
                             val text = BaseApplication.appContext.getString(
-                                R.string.voice_call_speech,
-                                frameName
+                                    R.string.voice_call_speech,
+                                    frameName
                             )
                             SpeechUtil.getInstance().removeSpeak(text)
                         } else {
@@ -1337,7 +1323,8 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
             Constant.EVENT_TCP_MSG -> {
                 val tcpModel = messageEvent.getMessage() as TcpModel
                 Log.e(TAG, "收到tcp消息: " + tcpModel.getType() + " " + tcpModel.getAction())
-                if (tcpModel.getType() == TcpType.VOICE) {
+
+             if (tcpModel.getType() == TcpType.VOICE) {
                     if (tcpModel.action == TcpAction.VoiceAction.VCALL) {
                         val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                         //视频通话请求
@@ -1349,7 +1336,7 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                             val callTcp = VoiceUtil.voiceCalling(tcpModel.tid, Constant.DEVICE_ID, tcpModel.fromId, interactionVO.id)
                             TcpClient.getInstance().sendMsg(callTcp.toJson())
                             return
-                        } else {
+                        }else {
                             //返回呼叫成功tcp
                             val responseTcpModel = VoiceUtil.voiceSuccess(tcpModel.tid, tcpModel.toId, tcpModel.fromId)
                             TcpClient.getInstance().sendMsg(responseTcpModel.toJson())
@@ -1385,10 +1372,18 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                             Constant.CALL_STATE = Constant.CALL_V_INCOMING
 
                             acceptCall(interactionVO, false, tcpModel.tid)
-
                             EventBus.getDefault().post(MessageEvent("finish", Constant.EVENT_FINISHh))
                         }
-                    }  else if (tcpModel.getAction() == TcpAction.VoiceAction.SUCCESS) {
+                    }
+                    else if (tcpModel.action == TcpAction.VoiceAction.CALL) {
+                        showHome()
+                        // 延迟1秒发送数据
+                        Handler(Looper.getMainLooper()).postDelayed({
+                            // 检查呼叫是否已经接听中或通话中
+                            EventBus.getDefault().post(MessageEvent(tcpModel, Constant.EVENT_DORM_CALLING))
+                        }, 500) // 延迟1秒(1000毫秒)
+                    }
+                    else if (tcpModel.getAction() == TcpAction.VoiceAction.SUCCESS) {
                         //服务器返回的呼叫成功tcp
                         val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                         Constant.interactionId = interactionVO.id
@@ -1822,15 +1817,15 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                         if (!SettingConfig.getNbVoiceWarning(activity)) {
                             return
                         }
-                         if (SettingConfig.getTtsMode(activity) != SettingConfig.TTS_ON) {
-                           SoundPoolManager.getInstance().playSound(5, 1.0f, 1.0f, 0)
-                            } else {
-                                if (tcpModel.data != null && tcpModel.data is String) {
-                                    val text = tcpModel.data as String
-                                    SpeechUtil.getInstance().stopSpeak(true)
-                                    SpeechUtil.getInstance().speakSingleText(text)
-                                }
+                        if (SettingConfig.getTtsMode(activity) != SettingConfig.TTS_ON) {
+                            SoundPoolManager.getInstance().playSound(5, 1.0f, 1.0f, 0)
+                        } else {
+                            if (tcpModel.data != null && tcpModel.data is String) {
+                                val text = tcpModel.data as String
+                                SpeechUtil.getInstance().stopSpeak(true)
+                                SpeechUtil.getInstance().speakSingleText(text)
                             }
+                        }
                     }
                 } else if (tcpModel.type == TcpType.ENTRACEGUARD) {
                     if (tcpModel.action == TcpAction.EntraceGuardAction.STRANGER) {
@@ -1956,10 +1951,10 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                             val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                             val json = JSON.parseObject(interactionVO.data.toString())
 
-                            if(json.containsKey("bId")){
+                            if (json.containsKey("bId")) {
                                 var bid = json.getString("bId")
-                                addTobrIngList(interactionVO.id.toString(),bid)
-                            }else{
+                                addTobrIngList(interactionVO.id.toString(), bid)
+                            } else {
                                 //喊话广播
                                 Constant.bcInteractionId = interactionVO.id
                             }
@@ -1978,11 +1973,11 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                     if (tcpModel.action == TcpAction.RoomCheckAction.START) {
                         //巡房开始 --
 //                        RoundList.add(frameId.toString())
-                        EventBus.getDefault().post(MessageEvent(frameId.toString(), Constant.EVENT_ROUND_HOUSE,clerkName.toString()))
+                        EventBus.getDefault().post(MessageEvent(frameId.toString(), Constant.EVENT_ROUND_HOUSE, clerkName.toString()))
                     } else if (tcpModel.action == TcpAction.RoomCheckAction.END) {
                         //巡房结束
 //                        removeValueFromViditingList(frameId.toString())
-                        EventBus.getDefault().post(MessageEvent(frameId.toString(), Constant.EVENT_ROUND_HOUSE,""))
+                        EventBus.getDefault().post(MessageEvent(frameId.toString(), Constant.EVENT_ROUND_HOUSE, ""))
                     }
                 } else if (tcpModel.type == TcpType.REMOTE_VISIT) {
                     if (tcpModel.action == TcpAction.REMOTEVISITAction.CALL) {
@@ -1990,78 +1985,78 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
                         val json = JSON.parseObject(tcpModel.data.toString())
                         val visitid = json.getString("id")
                         val toId = json.getString("callBedId")
-                        val callTcp = SwVisitUtil.visitCall(Constant.DEVICE_ID,toId.toInt() ,visitid)
+                        val callTcp = SwVisitUtil.visitCall(Constant.DEVICE_ID, toId.toInt(), visitid)
                         TcpClient.getInstance().sendMsg(callTcp.toJson())
                         viditingList.add(visitid.toString())
                         EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_VISIT_list))
                     } else if (tcpModel.action == TcpAction.REMOTEVISITAction.FAILED) {
                         //收到 分机不在线,通知界面,转接给小程序服务器
                         val visitid = tcpModel.data.toString()
-                        val callTcp = SwVisitUtil.visitHandoff( visitid)
+                        val callTcp = SwVisitUtil.visitHandoff(visitid)
                         VisitTcpClient.getInstance().sendMsg(callTcp.toJson())
                         removeValueFromViditingList(visitid.toString())
-                        if (skyCallFragment is VisitCallFragment){
+                        if (skyCallFragment is VisitCallFragment) {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_REMOVE_CALL_FRAGMENT))
-                        }else{
+                        } else {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_VISIT_list))
                         }
-                    }else if (tcpModel.action == TcpAction.REMOTEVISITAction.CANCEL) {
+                    } else if (tcpModel.action == TcpAction.REMOTEVISITAction.CANCEL) {
                         //收到 小程序取消 通知页面 比对id,取消探视(或者刷新页面)直接转给分机
                         val visitid = tcpModel.data.toString()
-                        val callTcp = SwVisitUtil.visitCancel(Constant.DEVICE_ID,visitid)
+                        val callTcp = SwVisitUtil.visitCancel(Constant.DEVICE_ID, visitid)
                         TcpClient.getInstance().sendMsg(callTcp.toJson())
                         removeValueFromViditingList(visitid.toString())
-                        if (skyCallFragment is VisitCallFragment){
+                        if (skyCallFragment is VisitCallFragment) {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_REMOVE_CALL_FRAGMENT))
-                        }else{
+                        } else {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_VISIT_list))
                         }
 
-                    }else if (tcpModel.action == TcpAction.REMOTEVISITAction.HANDOFF) {
+                    } else if (tcpModel.action == TcpAction.REMOTEVISITAction.HANDOFF) {
                         //收到 挂断 fromId不为null的是分机发过来的,为null的是 直接转给分机并且通知主机界面关闭
-                        if(tcpModel.tid!=null){
+                        if (tcpModel.tid != null) {
                             //分机发过来的
                             val visitid = tcpModel.data.toString()
                             val callTcp = SwVisitUtil.visitWxHANDOFF(visitid)
                             VisitTcpClient.getInstance().sendMsg(callTcp.toJson())
                             removeValueFromViditingList(visitid.toString())
-                        }else{
+                        } else {
                             //小程序发过来的
                             val visitid = tcpModel.data.toString()
-                            val callTcp = SwVisitUtil.visitHangup(Constant.DEVICE_ID,visitid)
+                            val callTcp = SwVisitUtil.visitHangup(Constant.DEVICE_ID, visitid)
                             TcpClient.getInstance().sendMsg(callTcp.toJson())
                             removeValueFromViditingList(visitid.toString())
                         }
-                        if (skyCallFragment is VisitCallFragment){
+                        if (skyCallFragment is VisitCallFragment) {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_REMOVE_CALL_FRAGMENT))
-                        }else{
+                        } else {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_VISIT_list))
                         }
-                    }else if (tcpModel.action == TcpAction.REMOTEVISITAction.DATA) {
+                    } else if (tcpModel.action == TcpAction.REMOTEVISITAction.DATA) {
                         //收到 通知刷新预约界面,左侧消息小红点。
                         SoundPoolManager.getInstance().playSound(6, 1.0f, 1.0f, 0)
                         EventBus.getDefault().post(MessageEvent("refresh", Constant.EVENT_VISIT_list))
 
-                    }else if (tcpModel.action == TcpAction.REMOTEVISITAction.CALLING) {
+                    } else if (tcpModel.action == TcpAction.REMOTEVISITAction.CALLING) {
                         //收到 通知小程序 分机正在通话中
                         val visitid = tcpModel.data.toString()
                         val callTcp = SwVisitUtil.visitIngCall(visitid)
                         VisitTcpClient.getInstance().sendMsg(callTcp.toJson())
                         removeValueFromViditingList(visitid.toString())
-                        if (skyCallFragment is VisitCallFragment){
+                        if (skyCallFragment is VisitCallFragment) {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_REMOVE_CALL_FRAGMENT))
-                        }else{
+                        } else {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_VISIT_list))
                         }
-                    }else if (tcpModel.action == TcpAction.REMOTEVISITAction.REJECT) {
+                    } else if (tcpModel.action == TcpAction.REMOTEVISITAction.REJECT) {
                         //收到 通知小程序 分机拒绝
                         val visitid = tcpModel.data.toString()
                         val callTcp = SwVisitUtil.visitreject(visitid)
                         VisitTcpClient.getInstance().sendMsg(callTcp.toJson())
                         removeValueFromViditingList(visitid.toString())
-                        if (skyCallFragment is VisitCallFragment){
+                        if (skyCallFragment is VisitCallFragment) {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_REMOVE_CALL_FRAGMENT))
-                        }else{
+                        } else {
                             EventBus.getDefault().post(MessageEvent("BackCall", Constant.EVENT_VISIT_list))
                         }
                     }
@@ -2126,7 +2121,7 @@ class NurseHome2Activity  : BaseActivity<NurseHomeActivityPresenter, NurseMainDo
             }
 
             Constant.EVENT_V_br_set -> {
-                destroyFragment(R.id.callingbed_main_frame,curFragment)
+                destroyFragment(R.id.callingbed_main_frame, curFragment)
                 supportFragmentManager.inTransaction {
 //                    curFragment = BroadcastSetFragment
                     val bundle = Bundle()

+ 64 - 55
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/dorm/DormCallRecordsFragment.kt

@@ -1,5 +1,7 @@
 package com.wdkl.ncs.android.component.nursehome.dorm
 
+import android.os.Handler
+import android.os.Looper
 import android.util.Log
 import android.view.View
 import androidx.recyclerview.widget.GridLayoutManager
@@ -12,6 +14,7 @@ import com.google.gson.Gson
 import com.scwang.smartrefresh.layout.footer.ClassicsFooter
 import com.wdkl.ncs.android.component.nursehome.R
 import com.wdkl.ncs.android.component.nursehome.activity.NurseHome2Activity
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
 import com.wdkl.ncs.android.component.nursehome.adapter.DormCallingItemAdapter
 import com.wdkl.ncs.android.component.nursehome.databinding.DormCallRecordsBinding
 import com.wdkl.ncs.android.component.nursehome.dorm.adapter.DormCallRecordsItemAdapter
@@ -123,7 +126,6 @@ class DormCallRecordsFragment : BaseFragment<CallRecordsFragmentPresenter, DormC
 
     fun showCallList() {
         dorm_ll_call_list.visibility = View.VISIBLE
-
         call_records_refresh.visibility = View.GONE
     }
     override fun onStart() {
@@ -146,6 +148,7 @@ class DormCallRecordsFragment : BaseFragment<CallRecordsFragmentPresenter, DormC
     override fun onResume() {
         super.onResume()
         presenter.loadFloor(page, pageSize, Constant.PART_ID, 0, "")
+        onUpdate()
     }
 
     override fun bindEvent() {
@@ -260,6 +263,65 @@ class DormCallRecordsFragment : BaseFragment<CallRecordsFragmentPresenter, DormC
                 Log.d("tcp", "refresh call list")
                 updateRecord()
             }
+
+            Constant.EVENT_DORM_CALLING -> {
+                val tcpModel = messageEvent.getMessage() as TcpModel
+                Log.d("tcp", "tcpType: " + tcpModel.type + ", tcpAction: " + tcpModel.action)
+                if (tcpModel.type == TcpType.VOICE) {
+                    val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+                    if (tcpModel.action == TcpAction.VoiceAction.CALL) {
+//                        //检查呼叫是否已经接听中或通话中
+                        if (Constant.callingId == tcpModel.fromId) {
+                            return
+                        }
+                        //返回呼叫成功tcp
+                        //val responseTcpModel = VoiceUtil.voiceSuccessHost(tcpModel.tid, tcpModel.toId, tcpModel.fromId)
+                        //TcpClient.getInstance().sendMsg(responseTcpModel.toJson())
+                        //1.更新点阵屏信息显示
+//                        LedHelper.updateLedInfo(interactionVO, true, false)
+
+                        //2.语音播报
+                        if (Constant.CALL_STATE != Constant.CALL_CALLING
+                                && Constant.CALL_STATE != Constant.CALL_OUTGOING
+                                && Constant.CALL_STATE != Constant.CALL_VISITING
+                                && Constant.CALL_STATE != Constant.CALL_V_INCOMING
+                                && Constant.CALL_STATE != Constant.CALL_ACCEPT
+                        ) {
+                            if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_ON) {
+                                var frameName: String? = ""
+                                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.fromDeviceType
+                                        || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.fromDeviceType
+                                        || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.fromDeviceType) {
+                                    //医生机,护士主机,其他主机,总控主机等
+                                    frameName = interactionVO.fromDeviceName
+                                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.fromDeviceType) {
+                                    //移动设备
+                                    frameName = interactionVO.fromMemberName
+                                } else {
+                                    //其他
+                                    if (Locale.CHINESE.getLanguage().equals(language)) {
+                                        frameName = Util.appendSpace(interactionVO.fromFrameFullName.replace("-", ","))
+                                    } else {
+                                        frameName = interactionVO.fromFrameFullName.replace("-", "")
+                                    }
+                                }
+                                val text = BaseApplication.appContext.getString(R.string.voice_call_speech, frameName)
+                                SpeechUtil.getInstance().addSpeech(text, false)
+                            } else if (SettingConfig.getTtsMode(activity) == SettingConfig.RING_ON) {
+                                RingPlayHelper.playRingTone(activity, R.raw.ring_tone, true)
+                            } else if (SettingConfig.getTtsMode(activity) == SettingConfig.MUSIC_ON) {
+                                RingPlayHelper.playRingTone(activity, R.raw.incoming_call, true)
+                            }
+                        }
+                        //3.刷新呼叫列表
+                        updateRecord()
+                        val item = CallingItem(System.currentTimeMillis(), tcpModel.tid, interactionVO, tcpModel.action, 0, null)
+                        if (callingAdapter != null) {
+                            callingAdapter?.addCall(item)
+                        }
+                    }
+                }
+            }
             //离线状态udp消息
             Constant.EVENT_UDP -> {
                 if (messageEvent.message is UdpItem) {
@@ -268,7 +330,6 @@ class DormCallRecordsFragment : BaseFragment<CallRecordsFragmentPresenter, DormC
                     if (UdpIndex.BED_CALL_OUT == udpItem.index) {
 
 
-
                         //1.更新点阵屏信息显示
                         //LedHelper.updateLedInfo(interactionVO, true, false)
                         //2.语音播报并显示呼叫
@@ -332,60 +393,8 @@ class DormCallRecordsFragment : BaseFragment<CallRecordsFragmentPresenter, DormC
                 Log.d("tcp", "tcpType: " + tcpModel.type + ", tcpAction: " + tcpModel.action)
                 if (tcpModel.type == TcpType.VOICE) {
                     val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
-                    if (tcpModel.action == TcpAction.VoiceAction.CALL) {
-                        //检查呼叫是否已经接听中或通话中
-                        if (Constant.callingId == tcpModel.fromId) {
-                            return
-                        }
-
 
-                        //返回呼叫成功tcp
-                        //val responseTcpModel = VoiceUtil.voiceSuccessHost(tcpModel.tid, tcpModel.toId, tcpModel.fromId)
-                        //TcpClient.getInstance().sendMsg(responseTcpModel.toJson())
-
-                        //1.更新点阵屏信息显示
-                        LedHelper.updateLedInfo(interactionVO, true, false)
-
-                        //2.语音播报
-                        if (Constant.CALL_STATE != Constant.CALL_CALLING
-                                && Constant.CALL_STATE != Constant.CALL_OUTGOING
-                                && Constant.CALL_STATE != Constant.CALL_VISITING
-                                && Constant.CALL_STATE != Constant.CALL_V_INCOMING
-                                && Constant.CALL_STATE != Constant.CALL_ACCEPT
-                        ) {
-                            if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_ON) {
-                                var frameName: String? = ""
-                                if (DeviceTypeEnum.DOCTOR_HOST.value() == interactionVO.fromDeviceType
-                                        || DeviceTypeEnum.NURSE_HOST.value() == interactionVO.fromDeviceType
-                                        || DeviceTypeEnum.OTHER_HOST.value() == interactionVO.fromDeviceType) {
-                                    //医生机,护士主机,其他主机,总控主机等
-                                    frameName = interactionVO.fromDeviceName
-                                } else if (DeviceTypeEnum.NURSE_WATCH.value() == interactionVO.fromDeviceType) {
-                                    //移动设备
-                                    frameName = interactionVO.fromMemberName
-                                } else {
-                                    //其他
-                                    if (Locale.CHINESE.getLanguage().equals(language)) {
-                                        frameName = Util.appendSpace(interactionVO.fromFrameFullName.replace("-", ","))
-                                    } else {
-                                        frameName = interactionVO.fromFrameFullName.replace("-", "")
-                                    }
-                                }
-                                val text = BaseApplication.appContext.getString(R.string.voice_call_speech, frameName)
-                                SpeechUtil.getInstance().addSpeech(text, false)
-                            } else if (SettingConfig.getTtsMode(activity) == SettingConfig.RING_ON) {
-                                RingPlayHelper.playRingTone(activity, R.raw.ring_tone, true)
-                            } else if (SettingConfig.getTtsMode(activity) == SettingConfig.MUSIC_ON) {
-                                RingPlayHelper.playRingTone(activity, R.raw.incoming_call, true)
-                            }
-                        }
-                        //3.刷新呼叫列表
-                        updateRecord()
-                        val item = CallingItem(System.currentTimeMillis(), tcpModel.tid, interactionVO, tcpModel.action, 0, null)
-                        if (callingAdapter != null) {
-                            callingAdapter?.addCall(item)
-                        }
-                    } else if (tcpModel.action == TcpAction.VoiceAction.CANCEL || tcpModel.action == TcpAction.VoiceAction.VOICE_OFF) {
+                        if (tcpModel.action == TcpAction.VoiceAction.CANCEL || tcpModel.action == TcpAction.VoiceAction.VOICE_OFF) {
                         //对方取消呼叫视为未接到
                         //if (tcpModel.action == TcpAction.VoiceAction.CANCEL) {
                         Constant.newMissedCall = true

+ 2 - 2
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/dorm/DromMianFragment.kt

@@ -52,7 +52,6 @@ class DromMianFragment: BaseFragment<BedMomMianFragmentPresenter, MainView4Layou
 
     override fun init() {
         presenter.getRoleList()
-
         updateInfo()
         val fragment = DormCallRecordsFragment()
         addCallFragment(fragment)
@@ -148,6 +147,7 @@ class DromMianFragment: BaseFragment<BedMomMianFragmentPresenter, MainView4Layou
         })
     }
     private fun addCallFragment(fragment: Fragment) {
+        if (infoFragment == fragment) return
         requireActivity().supportFragmentManager.beginTransaction().apply {
             infoFragment?.let {
                 remove(it)
@@ -170,7 +170,7 @@ class DromMianFragment: BaseFragment<BedMomMianFragmentPresenter, MainView4Layou
 
     private fun updateInfo() {
         //科室名称
-        main_view4_name.text = Constant.partDisplay
+        main_view4_name.text = Constant.DEVICE_NAME
 //        //床位名称
 //        main_view4_name_2.text = Constant.BED_NAME
     }

+ 1 - 1
android_host/src/main/res/layout/nurse_main_dorm.xml

@@ -38,7 +38,7 @@
                 android:layout_above="@+id/dorm_menu_but"
                 android:layout_centerInParent="true"
                 android:layout_marginBottom="@dimen/d30"
-                android:background="@mipmap/d_main_iot" />
+                android:background="@mipmap/d_main_br" />
 
             <ImageButton
                 android:id="@+id/dorm_menu_but"

BIN
android_host/src/main/res/mipmap-hdpi/d_main_br.png


+ 2 - 1
app/build.gradle

@@ -198,7 +198,8 @@ android {
         }
 
         ZC_3568D {//外购21.5寸横屏探视分机
-            manifest.srcFile 'src/main/AndroidManifest.xml'
+             manifest.srcFile 'src/main/sharedUserId/AndroidManifest.xml'
+//            manifest.srcFile 'src/main/AndroidManifest.xml'
         }
     }
     buildTypes {

+ 13 - 11
build.gradle

@@ -47,9 +47,9 @@ buildscript {
     /**
      * 配置要打包的模块
      */
-    ext.callingdoor = false
+    ext.callingdoor = true
     ext.android_bed = false
-    ext.android_host = true
+    ext.android_host = false
     ext.android_mobile = false
     ext.android_visiting = false
 
@@ -59,19 +59,19 @@ buildscript {
      * 配置默认是否启动的设备
      */
     //分机-床垫
-    ext.open_sleep = true
+    ext.open_sleep = false
 
     //分机-433
     ext.open_433 = false
 
     //设备类型  0 医院 1 月子中心 2 养老院 3 公寓 4 宿舍
-    ext.device_type = "4"
+    ext.device_type = "0"
 
     //睡眠设备类型  0 4g 1 串口 2 蓝牙 3 wifi
     ext.sleep_type = "3"
 
     //功能板  0 不带k6 k7 旧版本   1 带k6 k7 新版本
-    ext.feature_type = "1"
+    ext.feature_type = "0"
 
     //护士主机——声网探视
     ext.is_agora = false
@@ -83,16 +83,18 @@ buildscript {
 
     if (callingdoor) {
         //门口机
-        ext.app_version_code = 106
-        ext.app_version = "1.3.6"
+        ext.app_version_code =118
+        ext.app_version = "1.4.8"
+//        ext.app_version_code = 106
+//        ext.app_version = "1.3.6"
     } else if (android_bed) {
         //分机
-        ext.app_version_code =116
-        ext.app_version = "1.4.6"
+        ext.app_version_code =118
+        ext.app_version = "1.4.8"
     } else if (android_host) {
         //主机
-        ext.app_version_code = 117
-        ext.app_version = "1.3.17"
+        ext.app_version_code = 118
+        ext.app_version = "1.3.18"
     } else if (android_mobile) {
         ext.home_app = true
         //移动端

+ 2 - 0
callingdoor/build.gradle

@@ -148,6 +148,8 @@ dependencies {
     //志合sdk
     compile files('libs/zhylapi.jar')
 
+    implementation 'org.apache.commons:commons-lang3:3.12.0'
+
 }
 
 /**

+ 131 - 4
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivity.kt

@@ -12,9 +12,11 @@ import com.alibaba.fastjson.JSONObject
 import com.enation.javashop.android.jrouter.external.annotation.Router
 import com.enation.javashop.net.engine.model.NetState
 import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
 import com.wdkl.app.ncs.callingdoor.BuildConfig
 import com.wdkl.app.ncs.callingdoor.R
 import com.wdkl.app.ncs.callingdoor.agreement.CallingdoorAgreement
+import com.wdkl.app.ncs.callingdoor.bean.ButtonType
 import com.wdkl.app.ncs.callingdoor.bean.CallingItem
 import com.wdkl.app.ncs.callingdoor.bean.Trans433Data
 import com.wdkl.app.ncs.callingdoor.databinding.CallingdoorMainNewBinding
@@ -47,8 +49,10 @@ import com.wdkl.ncs.android.middleware.model.vo.DeviceRoomInfoVO
 import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO
 import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
 import com.wdkl.ncs.android.middleware.tcp.TcpClient
+import com.wdkl.ncs.android.middleware.tcp.channel.EventUtil
 import com.wdkl.ncs.android.middleware.tcp.channel.OtherUtil
 import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
+import com.wdkl.ncs.android.middleware.tcp.channel.YhUtil
 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
@@ -63,6 +67,7 @@ import kotlinx.android.synthetic.main.callingdoor_main_new.*
 import kotlinx.android.synthetic.main.main_view_layout.*
 import kotlinx.android.synthetic.main.view_bed_name.*
 import kotlinx.android.synthetic.main.view_title_layout.*
+import org.apache.commons.lang3.StringEscapeUtils
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -70,6 +75,7 @@ import org.linphone.core.Call
 import org.linphone.core.TransportType
 import serialporttest.utils.SerialPortUtil
 import serialporttest.utils.SerialPortUtil433
+import serialporttest.utils.SerialPortUtilLoar
 import serialporttest.utils.StringUtils
 import java.io.*
 import java.util.*
@@ -956,6 +962,10 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
 
         EventBus.getDefault().post(MessageEvent("updateCustom", Constant.EVENT_UPDATE_CUSTOM))
 
+        if (partSetting.deviceButtonFunction != null) {
+            Constant.device_button_function = partSetting.deviceButtonFunction
+        }
+
 
         //配置sip账号并连接sip服务器
         if (SettingConfig.getSipEnabled(activity) && !sipReg) {
@@ -1061,7 +1071,127 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
     }
 
     override fun serialPortBedOnclick2(status: String?) {
+        //测试模式
+        if (Constant.isText) {
+            if (status==">") {
+                EventBus.getDefault().post(MessageEvent("button4", Constant.EVENT_SERIAL_TEST))
+            } else if (status=="5") {
+                EventBus.getDefault().post(MessageEvent("button3", Constant.EVENT_SERIAL_TEST))
+            } else if (status=="<") {
+                EventBus.getDefault().post(MessageEvent("button2", Constant.EVENT_SERIAL_TEST))
+            } else if (status==";") {
+                EventBus.getDefault().post(MessageEvent("button1", Constant.EVENT_SERIAL_TEST))
+            } else if (status=="7") {
+                EventBus.getDefault().post(MessageEvent("button1", Constant.EVENT_SERIAL_TEST))
+            }
+            return
+        }
+        setButtonType(status)
+    }
+
+    /**
+     * 设置 按钮功能
+     * */
+    /**
+     * 设置 按钮功能
+     */
+    fun setButtonType(status: String?) {
+        if (Constant.device_button_function.isNullOrEmpty()) {
+            showMessage(R.string.str_set_button)
+            return
+        }
+        val jsonWithEscapes = Constant.device_button_function
+        val decodedJson = StringEscapeUtils.unescapeHtml4(jsonWithEscapes)
+        val buttonListType = object : TypeToken<List<ButtonType>>() {}.type
+        val buttonList: List<ButtonType> = Gson().fromJson(decodedJson, buttonListType)
+        val type = "KEY$status"
+        val currentTime = System.currentTimeMillis()
+
+        for (button in buttonList) {
+            if (type == button.key) {
+                when (button.type) {
+                    "SOS" -> handleSOSButton(currentTime)
+                    "VOICE" -> handleVoiceButton(button.value, currentTime)
+                    "EVENT" -> handleEventButton(button.value, currentTime)
+                    "REINFORCE" -> handleReinforceButton(currentTime)
+                    "NURSING" -> handleNursingButton(currentTime)
+                    else -> return // Ignore unknown types
+                }
+                return
+            }
+        }
+    }
 
+    private fun handleSOSButton(currentTime: Long) {
+        if (currentTime - clickTime > 2000) {
+            if (Constant.TCP_CONNECTED) {
+                val tcpModel = OtherUtil.SOSCall(Constant.DEVICE_ID)
+                TcpClient.getInstance().sendMsg(tcpModel.toJson())
+               HardWareFactroy.getHardTools().setSOSStart()
+            }
+            clickTime = currentTime
+        } else {
+            showMessage(R.string.wait_moment)
+        }
+    }
+
+    private fun handleVoiceButton(value: Any?, currentTime: Long) {
+        if (currentTime - clickTime > 2000) {
+            if (Constant.TCP_CONNECTED) {
+                when {
+                    Constant.CALL_STATE != Constant.CALL_STANDBY -> showMessage("通话忙...")
+                    TextUtils.isEmpty(Constant.SIP_ID) -> showMessage(R.string.no_custom)
+                    else ->  runOnUiThread {  startCall(Constant.VOICE_CALL)}
+                }
+            } else {
+                SerialPortUtilLoar.getInstance().sendSOS(Constant.DEVICE_REGISTER_ID)
+            }
+            clickTime = currentTime
+        } else {
+            showMessage(R.string.wait_moment)
+        }
+    }
+
+    private fun handleEventButton(value: Any?, currentTime: Long) {
+        if (currentTime - clickTime > 2000) {
+            if (Constant.TCP_CONNECTED) {
+                val tcpModel = EventUtil.eventKeyClick(Constant.DEVICE_ID, value as Int?)
+                TcpClient.getInstance().sendMsg(tcpModel.toJson())
+            }
+            clickTime = currentTime
+        } else {
+            showMessage(R.string.wait_moment)
+        }
+    }
+
+    private fun handleReinforceButton(currentTime: Long) {
+        if (currentTime - clickTime > 3000) {
+            if (Constant.TCP_CONNECTED) {
+                if (Constant.DEVICE_ID != -1) {
+                    runOnUiThread {
+                        OtherUtil.sendReinforce(Constant.DEVICE_ID)
+                        ReinforcementsDialogHelper.showDialog(activity, true)
+                    }
+
+                } else {
+                    showMessage("null device id!")
+                }
+            } else {
+                showMessage(R.string.net_error)
+            }
+            clickTime = currentTime
+        } else {
+            showMessage(R.string.wait_moment)
+        }
+    }
+
+    private fun handleNursingButton(currentTime: Long) {
+        if (currentTime - clickTime > 2000) {
+             YhUtil.sendReinforceResponsed(Constant.DEVICE_ID,0) // Uncomment if needed
+            clickTime = currentTime
+        } else {
+            showMessage(R.string.wait_moment)
+        }
     }
 
     override fun serialPortSOSCall(status: String?) {
@@ -1071,10 +1201,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
             if (System.currentTimeMillis() - clickSosTime > 10000 || !Constant.sosOn) {
                 runOnUiThread {
                     clickSosTime = System.currentTimeMillis()
-                    if (Constant.TCP_CONNECTED) {
+                    HardWareFactroy.getHardTools().setSOSStart()
 
-                        HardWareFactroy.getHardTools().setSOSStart()
-                    }
                 }
             }
         }
@@ -1597,7 +1725,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
                 VoiceManagerUtil.setSystemVoice(this, SettingConfig.getDoorDaytimeSystemVolume(this))
                 VoiceManagerUtil.setMusicVoice(this, SettingConfig.getDoorDaytimeSystemVolume(this))
                 view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_daylight)
-
                 //灭掉紧急按钮灯
                 AppTool.Time.delay(2000) {
                     SerialPortHelper.setSosLight("0")

+ 50 - 0
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/bean/ButtonType.java

@@ -0,0 +1,50 @@
+package com.wdkl.app.ncs.callingdoor.bean;
+
+import java.io.Serializable;
+
+public class ButtonType implements Serializable {
+
+
+    /**
+     * key : KEY;
+     * type : EVENT
+     * value : 30
+     */
+
+    private String key;
+    private String type;
+    private Object value;
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    @Override
+    public String toString() {
+        return "ButtonType{" +
+                "key='" + key + '\'' +
+                ", type='" + type + '\'' +
+                ", value=" + value +
+                '}';
+    }
+}

+ 1 - 1
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/helper/SOSHelper.java

@@ -38,7 +38,7 @@ public class SOSHelper {
             if (Constant.day_state == 1) {
                 SerialPortHelper.setSosLight("1");
             } else {
-                HardWareFactroy.getHardTools().setDoorLight(4);
+                SerialPortHelper.setSosLight("0");
             }
             Constant.sosOn = false;
             //如果当前在护理中则不操作门灯,如果不在护理中则重置门灯

+ 2 - 0
common/build.gradle

@@ -20,6 +20,8 @@ android {
             //moduleName "JavaShopCommonNDK"       //生成的so文件名字,调用C程序的代码中会用到该名字
             abiFilters "armeabi-v7a"
         }
+
+        buildConfigField 'String', 'device_type', "\"${project.rootProject.ext.device_type}\""
     }
     lintOptions {
         abortOnError false

+ 12 - 4
common/src/main/code/com/wdkl/ncs/android/lib/base/BaseActivity.kt

@@ -22,6 +22,7 @@ import com.enation.javashop.utils.base.tool.BaseToolActivity
 import com.enation.javashop.utils.base.tool.CommonTool
 import com.enation.javashop.utils.base.widget.LoadingDialog
 import com.meiai.manager.MyManager
+import com.wdkl.ncs.android.lib.BuildConfig
 import com.wdkl.ncs.android.lib.core.locale.LocaleMangerUtils
 import com.wdkl.ncs.android.lib.core.locale.SettingConfigNew
 import kotlinx.android.synthetic.main.custom_loading.view.*
@@ -99,10 +100,17 @@ abstract class BaseActivity<PresenterType : BaseContract.BasePresenter, DataBind
         /**父类初始化*/
         super.onCreate(savedInstanceState)
         requestWindowFeature(Window.FEATURE_NO_TITLE)
-        window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN or
-                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
-                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
-                WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
+        if (!BuildConfig.device_type.equals("4")){
+            window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN or
+                    WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
+                    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
+                    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
+        }else{
+            window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN or
+                    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
+                    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
+        }
+
 
         /**执行生命周期监听*/
         lifeCycleDo(LIFE_CYCLE_CREATE)

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

@@ -290,7 +290,7 @@ object AppTool {
                 if (!"rk3128".equals(Build.MODEL) && !"rk3368".equals(Build.MODEL)) {
                     Settings.System.putInt(
                             context.contentResolver,
-                            Settings.System.SCREEN_OFF_TIMEOUT, timeout
+                            Settings.System.SCREEN_OFF_TIMEOUT, timeout*60*1000
                     )
                 }
             } catch (e: java.lang.Exception) {

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

@@ -86,7 +86,6 @@ fun showMessage(message: String) {
     if (message == ""){
         return
     }
-
     try {
         Toaster.showShort(message)
     } catch (ex: Exception) {

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

@@ -640,4 +640,6 @@ public class Constant {
 
     public static final int EVENT_DORM_ADD_FRAGMENT = 0x218;
     public static final int EVENT_DORM_REMOVE_FRAGMENT = 0x219;
+
+    public static final int EVENT_DORM_CALLING = 0x220;
 }

+ 3 - 3
middleware/src/main/code/com/wdkl/ncs/android/middleware/model/vo/SingDataBean.java

@@ -105,7 +105,7 @@ public class SingDataBean implements Serializable {
         private double max_value;
         private double member_id;
         private String member_nickname;
-        private int min_value;
+        private double min_value;
         private int param_id;
         private String param_name;
         private int self_max_value;
@@ -226,11 +226,11 @@ public class SingDataBean implements Serializable {
             this.member_nickname = member_nickname;
         }
 
-        public int getMin_value() {
+        public double getMin_value() {
             return min_value;
         }
 
-        public void setMin_value(int min_value) {
+        public void setMin_value(double min_value) {
             this.min_value = min_value;
         }
 

+ 1 - 1
resource/src/main/res/values-zh/strings.xml

@@ -416,7 +416,7 @@
     <string name="reinforce_sent3">烟雾报警信息已发出</string>
     <string name="reinforce_sent4">红外报警信息已发出</string>
 
-    <string name="reinforce_respond">您的增援已响应,护士正在赶来的路上</string>
+    <string name="reinforce_respond">您的增援已响应,正在赶来的路上</string>
     <string name="reinforce_respond_2">您的请求已响应,请稍后</string>
     <string name="str_server_ip_empty">服务器地址不能为空</string>