Преглед изворни кода

总控护士主机3128版本

weizhengliang пре 2 година
комит
387e324fa8
100 измењених фајлова са 14079 додато и 0 уклоњено
  1. 11 0
      .gitignore
  2. 1 0
      android_host_manager/.gitignore
  3. 149 0
      android_host_manager/build.gradle
  4. 21 0
      android_host_manager/proguard-rules.pro
  5. 80 0
      android_host_manager/src/main/zk_h10_z3128_1h/AndroidManifest.xml
  6. 16 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/SipUtil/SipCallBack.java
  7. 661 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/SipUtil/SipHelperUtil.java.bak
  8. 150 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/AppUpdateActivity.kt
  9. 1408 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt
  10. 395 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/RegisterActivity.kt
  11. 75 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/BedItemAdapter.java
  12. 93 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/BroadcastAdapter.kt
  13. 230 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/CallRecordsItemAdapter.kt
  14. 145 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/CallingItemAdapter.kt
  15. 100 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/CostItemAdapter.kt
  16. 76 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/DoctorHostAdapter.kt
  17. 100 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/ExamAdapter.kt
  18. 68 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/FrameBedVosAdapter.kt
  19. 120 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/FrameBedVosConfinementAdapter.kt
  20. 128 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/FramePartItemAdapter.kt
  21. 77 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/HostDeviceAdapter.kt
  22. 44 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/InpatientWardAdapter.kt
  23. 51 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/LedItemAdapter.kt
  24. 56 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/NumAdapter.java
  25. 70 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/NurseMoveAdapter.kt
  26. 74 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/OtherHostAdapter.kt
  27. 71 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/ResponsibilityBedAdapter.kt
  28. 58 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/SickbedAdapter.kt
  29. 70 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/VisitManagementAdapter.kt
  30. 104 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/agreement/FloorActionAgreement.kt
  31. 32 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/di/NurseHomeComponent.kt
  32. 29 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/entity/CallingItem.java
  33. 104 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/BaseCallFragment.kt
  34. 128 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/BedsInTheWardFragment.kt
  35. 335 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/BroadcastFragment.kt
  36. 372 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/CallRecordsFragment.kt
  37. 181 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/DoctorHostFragment.kt
  38. 273 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/EntraceGuardVideoFragment.kt.bak
  39. 499 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/FramePartFragment.kt
  40. 142 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/InpatientWardFragment.kt
  41. 207 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/LedSettingsFragment.kt
  42. 182 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/NurseMoveFragment.kt
  43. 139 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/OtherHostFragment.kt
  44. 111 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SickbedFragment.kt
  45. 417 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SkyCallFragment.kt
  46. 683 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SystemSettingsFragment.kt
  47. 83 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/TrustManagementFragment.kt
  48. 172 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/VisitManagementFragment.kt
  49. 24 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/launch/NurseHomeLaunch.kt
  50. 546 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedC2MManager.java
  51. 59 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedItem.java
  52. 52 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedManager.java
  53. 103 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedManagerUtils.java
  54. 28 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedProgram.java
  55. 100 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/service/AppService.kt
  56. 215 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/service/RTCKeepLiveService.java.bak
  57. 761 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/settingconfig/SettingConfig.java
  58. 247 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AnrFcExceptionUtil.java.bak
  59. 239 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java
  60. 94 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUtil.java
  61. 199 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AsyncPlayer.java
  62. 92 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/CallDialogHelper.java
  63. 14 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/EthernetWifiCallBack.java
  64. 190 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/HttpHelper.java
  65. 91 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/LedHelper.java
  66. 225 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/MediaPlayHelper.java
  67. 587 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/NetHelper.java
  68. 39 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/RingPlayHelper.java
  69. 81 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/ScreenManagerUtil.kt
  70. 159 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/ServerConfigDialogHelper.java
  71. 202 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/SpeechUtil.java
  72. 87 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/TimeTransition.kt
  73. 194 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/VoiceManagerUtil.java
  74. 51 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/WarningDialogHelper.java
  75. 238 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/XCrashUtils.java
  76. 239 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/window/IncidentWindow.kt
  77. 104 0
      android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/window/VisitingWindow.java
  78. 7 0
      android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_down_in.xml
  79. 7 0
      android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_left_in.xml
  80. 7 0
      android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_right_out.xml
  81. 7 0
      android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_up_out.xml
  82. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bai_zhou_icon.png
  83. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bei_zhu.png
  84. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bg_bottom_btn.png
  85. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bian_qian.png
  86. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_fang.png
  87. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_qu.png
  88. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_qu_xuan_zhong.png
  89. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_ren_xiang_qing.png
  90. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_ren_xiang_qing_man.png
  91. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/dian_hua.png
  92. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/gua_duan.png
  93. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/guang_bo.png
  94. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/guang_bo_xuan_zhong.png
  95. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/guang_bo_yi_chu.png
  96. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_chu_wei_jie.png
  97. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_chu_yi_jie.png
  98. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_jiao.png
  99. BIN
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_jiao_ji_lu_to_xiang.png
  100. 0 0
      android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_ru_wei_jie.png

+ 11 - 0
.gitignore

@@ -0,0 +1,11 @@
+*.iml
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.idea/
+.DS_Store
+/build
+/captures
+/gradle
+.externalNativeBuild
+/.gradle

+ 1 - 0
android_host_manager/.gitignore

@@ -0,0 +1 @@
+/build

+ 149 - 0
android_host_manager/build.gradle

@@ -0,0 +1,149 @@
+if (componentTag){
+    apply plugin: 'com.android.application'
+    apply plugin: 'com.enation.javashop.aspectjrt'
+}else{
+    apply plugin: 'com.android.library'
+}
+
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-kapt'
+
+kapt {
+    arguments {
+        arg("moduleName", project.getName())
+    }
+}
+
+android {
+    compileSdkVersion target_sdk_version
+    buildToolsVersion build_tools_version
+
+    defaultConfig {
+        if (componentTag){
+        applicationId "com.wdkl.ncs.android.component.nursehome"
+            multiDexEnabled true
+        }
+        minSdkVersion min_sdk_version
+        targetSdkVersion target_sdk_version
+        versionCode app_version_code
+        versionName app_version
+        dataBinding {
+            enabled = true
+        }
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+        buildConfigField "String", "BUILD_TIME", getDate()
+    }
+
+    lintOptions {
+        abortOnError false
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+
+    sourceSets {
+        println 'config app_device_type ===== ' + app_device_type
+
+        if ("zk_h10_w_ke_1" == app_device_type) {
+            //
+        } else if ("zk_h10_z_3128_1" == app_device_type) {
+            main.java.srcDirs += 'src/main/zk_h10_z3128_1h/java'
+            main.res.srcDirs += 'src/main/zk_h10_z3128_1h/res'
+            main.manifest.srcFile 'src/main/zk_h10_z3128_1h/AndroidManifest.xml'
+        }
+    }
+}
+
+//获取编译日期
+String getDate() {
+    Date date = new Date();
+    String dates = "\""+date.format("yyyy年MM月dd日", TimeZone.getTimeZone("UTC"))+"\"";
+    return dates;
+}
+
+dependencies {
+    compile fileTree(dir: 'libs', include: ['*.jar'])
+    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+        exclude group: 'com.android.support', module: 'support-annotations'
+    })
+    /**
+     * 单元测试
+     */
+    testCompile 'junit:junit:4.12'
+
+    /**
+     *  Android基础依赖库
+     */
+    compile "com.android.support:design:$support_library_version"
+    compile "com.android.support:support-v4:$support_library_version"
+    compile "com.android.support:cardview-v7:$support_library_version"
+    compile "com.android.support:appcompat-v7:$support_library_version"
+
+    /**
+     * 公共库依赖
+     */
+    compile project(':middleware')
+
+    if(componentTag){
+        debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
+        releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
+        testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
+    }
+
+    /**
+     * Dagger编译依赖
+     */
+    kapt 'com.google.dagger:dagger-compiler:2.7'
+
+    /**
+     * Kotlin依赖
+     */
+    kapt 'com.android.databinding:compiler:2.3.3'
+
+    /**
+     * 路由注解处理器
+     */
+    kapt "com.enation.geamtear:jrouter-compiler:$router_version"
+
+    /**
+     *  constraint-layout布局依赖
+     */
+    compile 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
+
+    //compile 'com.github.anrwatchdog:anrwatchdog:1.3.0'
+
+    //使用xCrash捕获异常
+    implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.0.0'
+
+    //compile project(':starRTC')
+    //compile project(':AmDemo_R')
+
+    //web rtc
+    //compile project(':webrtc')
+    //compile project(':rtc-chat')
+
+    //janus信令
+    compile project(':janus')
+    implementation 'org.webrtc:google-webrtc:1.0.32006'
+
+    //串口
+    compile project(':nurseMainLib')
+    compile project(':listenvision')
+}
+
+/**
+ * kawo组件化框架配置
+ */
+if(componentTag){
+    kawo {
+        /**
+         * Aop注解排除Jar
+         */
+        aspectExcludeJarFilter 'com.enation.geamtear.pay','AlipaySdk'
+    }
+}

+ 21 - 0
android_host_manager/proguard-rules.pro

@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 80 - 0
android_host_manager/src/main/zk_h10_z3128_1h/AndroidManifest.xml

@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    package="com.wdkl.ncs.android.component.nursehome">
+
+
+    <!-- Android8.0未知来源权限 -->
+    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
+    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
+    <!-- silentUpdate -->
+    <uses-permission
+        android:name="android.permission."
+        tools:ignore="ProtectedPermissions" />
+
+    <!-- for sip mCall -->
+    <uses-permission android:name="android.permission.USE_SIP" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
+    <uses-permission
+        android:name="android.permission.WRITE_SECURE_SETTINGS"
+        tools:ignore="ProtectedPermissions" />
+
+    <uses-feature
+        android:name="android.hardware.sip.voip"
+        android:required="true" />
+    <uses-feature
+        android:name="android.hardware.wifi"
+        android:required="true" />
+    <uses-feature
+        android:name="android.hardware.microphone"
+        android:required="true" />
+
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <uses-permission
+        android:name="android.permission.DEVICE_POWER"
+        tools:ignore="ProtectedPermissions" />
+    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
+
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
+    <uses-permission android:name="android.permission.READ_CONTACTS"/>
+    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
+    <uses-permission android:name="android.permission.BLUETOOTH"/>
+    <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
+    <uses-permission android:name="android.permission.BROADCAST_STICKY"/>
+    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <uses-permission android:name= "android.manifest.permission.INTERNAL_SYSTEM_WINDOW"/>
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+    <!--     设置屏幕亮度-->
+    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"
+        tools:ignore="ProtectedPermissions" />
+    <uses-permission android:name="android.permission.WRITE_SETTINGS"
+        tools:ignore="ProtectedPermissions" />
+    <!--    音量权限-->
+    <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
+
+
+    <application
+        android:allowBackup="true"
+        android:label="@string/wdkl_app_name"
+        android:supportsRtl="true">
+        <activity android:name=".activity.NurseHomeActivity">
+        </activity>
+
+        <activity android:name=".activity.AppUpdateActivity"
+            android:screenOrientation="landscape"
+            android:launchMode="singleTask"/>
+
+    </application>
+
+
+</manifest>

+ 16 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/SipUtil/SipCallBack.java

@@ -0,0 +1,16 @@
+package com.wdkl.ncs.android.component.nursehome.SipUtil;
+
+/**
+ * ======================Sip回调接口=====================
+ * Created by dengzhe on 2018/2/7.
+ */
+
+public interface SipCallBack {
+    void startCall(String sipAddress);//开始拨打
+
+    void autoTalking();//自动接听
+
+    void endCall();//结束通话
+
+
+}

+ 661 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/SipUtil/SipHelperUtil.java.bak

@@ -0,0 +1,661 @@
+package com.wdkl.ncs.android.component.nursehome.SipUtil;
+
+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.Build;
+import android.os.CountDownTimer;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.util.Log;
+import android.view.WindowManager;
+
+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.ncs.android.component.nursehome.activity.NurseHomeActivity;
+import com.wdkl.ncs.android.component.nursehome.util.EthernetWifiCallBack;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by dengzhe on 2017/12/18.
+ */
+public class SipHelperUtil implements EthernetWifiCallBack {
+
+    private String TAG = SipHelperUtil.class.getSimpleName();
+
+    //挂断状态  21
+    public static int CALLING_ENDING = 21;
+
+    /**
+     * 注册中
+     */
+    public static final String REGISTERING = "register_ing";
+    /**
+     * 注册失败.
+     */
+    public static final String REGISTERFAIL = "register_fail";
+    /**
+     * 注册完成
+     */
+    public static final String REGISTERCOM = "register_com";
+
+
+    private static String SIP_IP = "192.168.101.1";
+    private static String SIP_IP_PORT = ":5060";
+    private static String SIP_PASS_WORD = "4000361820";
+    private static String SIP_ID = "4000361820";
+
+    /**
+     * Sip启动注册.
+     */
+    protected int mSipRegisterTime = 3000;
+    private Handler sipRegisterHandler = null;
+    private Runnable sipRegisterRunnable = null;
+
+    /**
+     * SIP信息
+     */
+    public static final String SipInfoTag = "SipInfo";
+    /**
+     * 电话呼叫对象
+     */
+    private List<VvsipCall> mVvsipCalls = null;
+
+
+    private static SipHelperUtil mSipRegisterUtil;
+
+    public Handler getSipRegisterHandler() {
+        return sipRegisterHandler;
+    }
+
+    public Runnable getSipRegisterRunnable() {
+        return sipRegisterRunnable;
+    }
+
+    public List<VvsipCall> getmVvsipCalls() {
+        return mVvsipCalls;
+    }
+
+    /**
+     * Gets instance.
+     *
+     * @param context the context
+     * @return the instance
+     */
+    private static Context contexts;
+
+    public static SipHelperUtil getInstance(Context context) {
+
+        if (mSipRegisterUtil == null) {
+            synchronized (SipHelperUtil.class) {
+                if (mSipRegisterUtil == null) {
+                    mSipRegisterUtil = new SipHelperUtil();
+                    contexts = context;
+                }
+            }
+        }
+        return mSipRegisterUtil;
+    }
+
+    /**
+     * Instantiates a new Sip register util.
+     */
+    private SipHelperUtil() {
+        setEthernetWifiCallBack(this);
+        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, 0);
+            return;
+        }
+        sipRegisterHandler.postDelayed(sipRegisterRunnable, mSipRegisterTime);
+
+
+    }
+
+    /**
+     * 检测Sip服务是否注册成功
+     */
+    public void isSuccessRegisterSip() {
+        VvsipTask vvsipTask = VvsipTask.getVvsipTask();
+        if (vvsipTask != null && VvsipTask.global_failure != 0) {
+            /**
+             * ==================================sip服务启动失败 ================================
+             */
+            Intent intent = new Intent(Intent.ACTION_MAIN);
+            intent.setClass(contexts.getApplicationContext(), VvsipService.class);
+            contexts.stopService(intent);
+//            LogUtil.i(SipInfoTag, "注册失败:lifecycle // isSuccessStartSipService");
+        } else {
+//            finish();
+            /**
+             * ==================================sip服务启动成功 ================================
+             */
+//            LogUtil.i(SipInfoTag, "sip服务启动:lifecycle // isSuccessStartSipService");
+
+        }
+    }
+
+    /**
+     * 注销Sip服务
+     */
+    public void unRegisterSip() {
+//        LogUtil.i(SipInfoTag, "lifecycle // onDestroy");
+
+        IVvsipService sipservice = VvsipService.getService();
+        if (contexts instanceof IVvsipServiceListener && sipservice != null) {
+            sipservice.removeListener((IVvsipServiceListener) contexts);
+        }
+        getSipServiceStartHandler().removeCallbacks(getSipServiceStartRunnable());
+        sipRegisterHandler.removeCallbacks(sipRegisterRunnable);
+        if (getSipServiceConnection() != null && isRegister) {
+            try {
+                contexts.unbindService(getSipServiceConnection());
+                setSipServiceConnection(null);
+            } catch (IllegalArgumentException e) {
+                e.printStackTrace();
+            }
+        }
+        if (mVvsipCalls != null) {
+            mVvsipCalls.clear();
+            mVvsipCalls = null;
+        }
+
+//        Log.i(SipInfoTag, "lifecycle // onDestroy");
+    }
+
+    private boolean isFirstRegister = true;
+    public static String sipMessageCounts = "";
+
+    /**
+     * Sip信息获取
+     */
+    public void obtainSipInfo() {
+        if (sipMessageCounts.equals(REGISTERCOM) && ethernetS) {//sip注册成功并且以太网连上
+            return;
+        }
+        IVvsipService sipService = VvsipService.getService();
+        if (sipService != null) {
+            sipService.addListener((IVvsipServiceListener) contexts);
+            sipService.setMessageHandler(messageHandler);
+        } else {
+//            LogUtil.i(SipInfoTag, "lifecycle // _service==null");
+        }
+        sipRegister();
+        failUiRefreshSip();
+    }
+
+    /**
+     * 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(SipInfoTag, "VvsipEvent received (?" + msg.what + " " + msg.arg1
+//                    + " " + msg.arg2 + ")\n");
+//            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")) {//注册成功
+                Log.e(TAG,"SIP注册成功");
+//                sipMessageCounts = CallingDoorActivity.REGISTERCOM;
+//                EventBus.getDefault().post(new MessageEvent(CallingDoorActivity.REGISTERCOM, EVENT_SIP_REGISTER_STATUS));
+                if (mSipThread != null) {
+                    mSipThread.interrupt();
+                    mSipThread = null;
+                }
+                if (msg.obj.toString().contains("408")) {//超时
+                    Log.e(TAG,"SIP注册超时");
+//                    sipMessageCounts = CallingDoorActivity.REGISTERFAIL;
+//                    EventBus.getDefault().post(new MessageEvent(CallingDoorActivity.REGISTERFAIL, EVENT_SIP_REGISTER_STATUS));
+                    sipRegister();
+                }
+            } else {//注册失败
+
+                Log.e(TAG,"SIP注册失败");
+//                sipMessageCounts = CallingDoorActivity.REGISTERFAIL;
+//                EventBus.getDefault().post(new MessageEvent(CallingDoorActivity.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();
+            }
+        }
+    };
+
+    /**
+     * UI刷新:SIP失败
+     */
+    private void failUiRefreshSip() {
+        if (!ethernetS) {
+//            sipMessageCounts = CallingDoorActivity.REGISTERFAIL;
+//            EventBus.getDefault().post(new MessageEvent(CallingDoorActivity.REGISTERFAIL, EVENT_SIP_REGISTER_STATUS));
+            if (mSipThread != null) {
+                mSipThread.interrupt();
+                mSipThread = null;
+            }
+//            LogUtil.e(SipInfoTag, "以太网断开,SIP UI状态刷新为失败");
+        }
+    }
+
+    /**
+     * ====================Sip注册======================
+     */
+    private Thread mSipThread;
+
+    private static class SipThread extends Thread {
+        WeakReference<NurseHomeActivity> mThreadCallingDoorActivity;
+
+        public SipThread(NurseHomeActivity activity) {
+            mThreadCallingDoorActivity = new WeakReference<NurseHomeActivity>(
+                    activity);
+        }
+
+        @Override
+        public void run() {
+            super.run();
+            if (mThreadCallingDoorActivity == null)
+                return;
+            if (mThreadCallingDoorActivity.get() != null) {
+                VvsipService sipService = VvsipService.getService();
+                try {
+                    if (sipService != null && !SipHelperUtil.getInstance(contexts).sipinfo.contains("200 OK") && ethernetS) {//注册正在进行中
+//                        sipMessageCounts = CallingDoorActivity.REGISTERING;
+//                        EventBus.getDefault().post(new MessageEvent(CallingDoorActivity.REGISTERING, EVENT_SIP_REGISTER_STATUS));
+                        sipService.register(SIP_IP +SIP_IP_PORT ,
+                                SIP_ID, SIP_PASS_WORD);
+                    //                        LogUtil.i(SipInfoTag, "Sip地址" + Constants.SIP_IP + SIP_IP_END + "\nSip账号" + Constants.SIP_ID + "\nSip密码" + Constants.SIP_PASS_WORD);
+                        handleCount++;
+                    //                        LogUtil.d(SipInfoTag, "Sip第-----" + (handleCount + 1) + "-------次註冊");
+//                        LogUtil.e(SipInfoTag, "以太网连接,SIP UI状态刷新为注册中");
+                    } else if (sipService != null && SipHelperUtil.getInstance(contexts).sipinfo.contains("200 OK")) {
+//                        sipMessageCounts = CallingDoorActivity.REGISTERCOM;
+//                        EventBus.getDefault().post(new MessageEvent(CallingDoorActivity.REGISTERCOM, EVENT_SIP_REGISTER_STATUS));
+                    }
+                } catch (NullPointerException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+
+    private void sipRegister() {
+        synchronized (this) {
+            mSipThread = new SipThread((NurseHomeActivity) contexts);
+            if (handleCount < 3) {
+                if (mCountDownAutoTimer == null) {
+                    mCountDownAutoTimer = new CountDownTimer(10000, 1000) {
+                        @Override
+                        public void onTick(long l) {
+//                            LogUtil.d(SipInfoTag, "已經註冊第" + (handleCount + 1) + "次:" + l / 1000 + "秒后重啟註冊");
+                        }
+
+                        @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(CALLING_ENDING);
+        call.stop();
+        sipService.setSpeakerModeOff();
+        sipService.stopPlayer();
+        sipService.setAudioNormalMode();
+
+    }
+
+    /**
+     * 添加一个电话呼叫对象
+     *
+     * @param call
+     */
+    public void addCallObject(final VvsipCall call) {
+        ((Activity) contexts).runOnUiThread(new Runnable() {
+            public void run() {
+                try {
+                    if (call == null) {
+                        return;
+                    }
+
+                    if (mVvsipCalls == null)
+                        return;
+                    mVvsipCalls.add(call);
+
+                    if (Build.VERSION.SDK_INT >= 5) {
+                        ((Activity) contexts).getWindow().addFlags( // WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
+                                // |
+                                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
+                                        | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
+                                        | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+                    }
+
+                } catch (Exception e) {
+//                    LogUtil.e(SipInfoTag, "onNewVvsipCallEvent: " + e);
+                }
+            }
+        });
+    }
+
+    /**
+     * 移除一个电话呼叫对象
+     *
+     * @param call
+     */
+    public void removeCallObject(final VvsipCall call) {
+        ((Activity) contexts).runOnUiThread(new Runnable() {
+            public void run() {
+                try {
+                    if (call == null) {
+                        return;
+                    }
+
+                    // 4 crash detected here for 4.0.9 with mVvsipCalls=NULL
+                    if (mVvsipCalls == null)
+                        return;
+                    mVvsipCalls.remove(call);
+
+                    if (mVvsipCalls.size() == 0) {
+                        if (Build.VERSION.SDK_INT >= 5) {
+                            ((Activity) contexts).getWindow()
+                                    .clearFlags( // WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
+                                            // |
+                                            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
+                                                    | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
+                                                    | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+                        }
+                    }
+                } 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 mContext, String className) {
+
+        boolean isRunning = false;
+        ActivityManager activityManager = (ActivityManager) mContext
+                .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() {
+
+                Intent intent = new Intent(contexts.getApplicationContext(), VvsipService.class);
+                contexts.startService(intent);
+
+                sipServiceConnection = new ServiceConnection() {
+                    public void onServiceConnected(ComponentName name, IBinder service) {
+                        IVvsipService sipservice = ((VvsipServiceBinder) service).getService();
+                        if (contexts instanceof IVvsipServiceListener) {
+                            sipservice.addListener((IVvsipServiceListener) contexts);
+//                            LogUtil.i(SipInfoTag, "Connected!");
+                            SipHelperUtil.getInstance(contexts).obtainSipInfo();//Sip信息获取
+                        }
+                    }
+
+                    public void onServiceDisconnected(ComponentName name) {
+//                        LogUtil.i(SipInfoTag, "Disconnected!");
+                    }
+                };
+                if (!SipHelperUtil.isServiceRunning(contexts, "com.vvsip.ansip.VvsipService")) {
+                    isRegister = contexts.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 "未知错误";
+        }
+    }
+
+    //======================Sip回调接口=====================
+    private SipCallBack mSipCallBack;
+
+    public void setSipCallBack(SipCallBack mSipCallBack) {
+        this.mSipCallBack = mSipCallBack;
+    }
+
+    public SipCallBack getmSipCallBack() {
+        return mSipCallBack;
+    }
+
+    //======================以太网和wifi状态接口=====================
+    private EthernetWifiCallBack mEthernetWifiCallBack;
+
+    public void setEthernetWifiCallBack(EthernetWifiCallBack mEthernetWifiCallBack) {
+        this.mEthernetWifiCallBack = mEthernetWifiCallBack;
+    }
+
+    public EthernetWifiCallBack getmEthernetWifiCallBack() {
+        return mEthernetWifiCallBack;
+    }
+
+    private static boolean ethernetS = true;//获取以太网状态
+    private static boolean wifiS = false;//获取wifi状态
+
+    @Override
+    public boolean ethernetStatus(boolean status) {
+        ethernetS = status;
+        return status;
+    }
+
+    @Override
+    public boolean wifiStatus(boolean status) {
+        wifiS = status;
+        return status;
+    }
+}

+ 150 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/AppUpdateActivity.kt

@@ -0,0 +1,150 @@
+package com.wdkl.ncs.android.component.nursehome.activity
+
+import android.text.TextUtils
+import android.util.Log
+import com.enation.javashop.android.jrouter.external.annotation.Router
+import com.enation.javashop.net.engine.model.NetState
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.databinding.UpdateLayBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.component.nursehome.util.AppUpdateHelper
+import com.wdkl.ncs.android.component.nursehome.util.HttpHelper
+import com.wdkl.ncs.android.lib.base.BaseActivity
+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.logic.contract.nursehome.AppUpdateContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.AppUpdatePresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.update_lay.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+@Router(path = "/nursehome/update")
+class AppUpdateActivity :BaseActivity<AppUpdatePresenter, UpdateLayBinding>(), AppUpdateContract.View {
+    private val TAG = "AppUpdateActivity"
+
+    private val urlManager = UrlManager.build()
+
+    override fun getLayId(): Int {
+        return R.layout.update_lay
+    }
+
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    override fun init() {
+        Constants.app_updating = true
+        if (!TextUtils.isEmpty(Constants.app_path)) {
+            downLoadAPK(urlManager.buyer + "/" + Constants.app_path)
+        } else {
+            showMessage("下载路径异常")
+            finish()
+        }
+    }
+
+    /**
+     * 下载APK包
+     */
+    fun downLoadAPK(url: String) {
+        Log.d(TAG, "downLoadAPK  url==$url")
+        activity_appupdate_dialog_progressview.setCurProgress(0)
+        activity_update_version.setText(Constants.app_path.substringAfterLast("/"))
+        activity_update_version.setOnLongClickListener {
+            Log.d(TAG, "downLoadAPK cancel...")
+            showMessage("取消升级")
+            HttpHelper.cancelRequestByTag(TAG)
+            activity.finish()
+
+            return@setOnLongClickListener true
+        }
+
+        HttpHelper.download(url, TAG, object : HttpHelper.DownloadListener {
+            override fun onDownloadSuccess() {
+                Log.d("download", "onDownloadSuccess==" + "成功")
+                runOnUiThread {
+                    activity_update_text_download.text = "正在安装,请稍后..."
+                }
+                startInstallApk()
+            }
+
+            override fun onDownloading(progress: Int) {
+                runOnUiThread {
+                    activity_appupdate_dialog_progressview.setCurProgress(progress)
+                }
+            }
+
+            override fun onDownloadFailed() {
+                Log.d("download", "onDownloadFailed==" + "失败")
+                finish()
+            }
+        })
+    }
+
+    fun startInstallApk() {
+        //AppUpdateHelper.installAPK(this);
+        //finish()
+
+        Thread{
+            AppUpdateHelper.updateApp(this, object : AppUpdateHelper.UpdateCallBack {
+                override fun onFailed() {
+                    runOnUiThread {
+                        showMessage("升级失败")
+                        finish()
+                    }
+                }
+
+                override fun onSuccess() {
+                    runOnUiThread {
+                        showMessage("升级成功")
+                        //finish()
+                        android.os.Process.killProcess(android.os.Process.myPid())
+                        System.exit(0)
+                    }
+                }
+            })
+        }.start()
+    }
+
+    override fun bindEvent() {
+        //
+    }
+
+    override fun destory() {
+        Constants.app_updating = false
+    }
+
+    //数据加载错误
+    override fun onError(message: String, type: Int) {
+        //
+    }
+
+    //数据加载完成
+    override fun complete(message: String, type: Int) {
+        //
+    }
+
+    //开始获取数据
+    override fun start() {
+        //
+    }
+
+    //网络监听
+    override fun networkMonitor(state: NetState) {
+        state.filter(onMobile = {
+
+        },onWifi = {
+
+        },offline = {
+
+        })
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        //
+    }
+}

Разлика између датотеке није приказан због своје велике величине
+ 1408 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/NurseHomeActivity.kt


+ 395 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/activity/RegisterActivity.kt

@@ -0,0 +1,395 @@
+package com.wdkl.ncs.android.component.nursehome.activity
+
+import android.Manifest
+import android.app.AlarmManager
+import android.content.Context
+import android.graphics.Color
+import android.os.Build
+import android.os.Handler
+import android.text.TextUtils
+import android.util.Log
+import com.enation.javashop.android.jrouter.external.annotation.Router
+import com.enation.javashop.net.engine.model.NetState
+import com.enation.javashop.net.engine.plugin.permission.RxPermissions
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.ActivityRegisterBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseActivity
+import io.reactivex.Observable
+import com.wdkl.ncs.android.component.nursehome.BuildConfig
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.util.AppUpdateHelper
+import com.wdkl.ncs.android.component.nursehome.util.NetHelper
+import com.wdkl.ncs.android.component.nursehome.util.ServerConfigDialogHelper
+import com.wdkl.ncs.android.lib.base.BaseApplication
+import com.wdkl.ncs.android.lib.utils.*
+import com.wdkl.ncs.android.middleware.api.UrlManager
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.DeviceContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.DevicePresenter
+import com.wdkl.ncs.android.middleware.model.ThirdServerInfo
+import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration
+import com.wdkl.ncs.android.middleware.model.dos.PartSettingDO
+import com.wdkl.ncs.android.middleware.model.dto.TcpSeverDTO
+import com.wdkl.ncs.android.middleware.model.vo.NurseDeviceInfoVO
+import com.wdkl.ncs.android.middleware.udp.ServerInfoUtil
+import com.wdkl.ncs.android.middleware.utils.CommonUtils
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.activity_register.*
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import serialporttest.utils.SerialPortUtil
+import java.lang.StringBuilder
+import java.util.concurrent.TimeUnit
+
+/**
+ *注册页Activity
+ */
+@Router(path = "/nursehome/register")
+class RegisterActivity : BaseActivity<DevicePresenter, ActivityRegisterBinding>(),  DeviceContract.View {
+    var TAG = RegisterActivity::class.java.getSimpleName()
+
+    val QR_CODE_PATH = "http://m.wdklian.com/care/apk/care.user?type=NCS_DEVICE"
+
+    private val handler by lazy { Handler() }
+
+    private var serverIp = ""
+    private var serverSuccess = false
+    private var cancelRestart = false
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.activity_register
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+        AppTool.SystemUI.showNavigationBar(this,false)
+        AppTool.SystemUI.ImmersiveWithBottomBarColor(this, Color.BLACK)
+        requestPermissions()
+    }
+
+    private fun permissionGranted() {
+        Constants.mac = NetHelper.getInstance().macAddress
+        Log.e(TAG,"mac "+Constants.mac)
+        tv_local_mac.text = "本机MAC:"+Constants.mac
+
+        Thread{
+            //val logoBitmap = BitmapFactory.decodeResource(resources, R.mipmap.erlogo)
+            var builder = StringBuilder()
+            builder.append(QR_CODE_PATH)
+            builder.append("&code=")
+            builder.append(Constants.DEVICE_CODE)
+            builder.append("&mac=")
+            builder.append(Constants.mac)
+            builder.append("&model=")
+            builder.append(Constants.DEVICE_MODEL)
+            builder.append("&hard_ver=")
+            builder.append(Constants.DEVICE_HARD_VER)
+            builder.append("&soft_ver=")
+            builder.append(Constants.DEVICE_SOFT_VER)
+            builder.append("&device_type=")
+            builder.append(Constants.DEVICE_TYPE)
+            builder.append("&device_name=")
+            builder.append(Constants.DEVICE_NAME)
+            val code = EcodeHelper().createQRImage(builder.toString(),320, null)
+            activity.runOnUiThread {
+                view_qr_code?.setImageBitmap(code)
+            }
+        }.start()
+        val macAddr = NetHelper.getInstance().macAddress
+        val ipAddr = NetHelper.getInstance().localIP
+        val buildUrl = UrlManager.build()
+        serverIp =  buildUrl.buyer.substringAfterLast("//").substringBefore(":")
+
+        tv_local_ip.text = "本机IP: " + ipAddr + ", server: " + serverIp
+        tv_local_mac.text = "本机MAC: " + macAddr
+        val str = ("App名称: " + getString(R.string.wdkl_app_name)
+                + "\r\nAPP版本: V" + BuildConfig.VERSION_NAME + "_" + BuildConfig.VERSION_CODE + "_" + Build.MODEL
+                + "\r\n发布日期:" + BuildConfig.BUILD_TIME
+                + "\r\nSDK版本: " + Build.VERSION.SDK_INT)
+
+        if (Constants.DEVICE_7INCH) {
+            tv_app_version.text = str + "\r\n--7寸主机"
+        } else {
+            tv_app_version.text = str
+        }
+
+        //presenter.loadData(Constants.mac!!)
+
+        //检查服务器地址接口是否可用,可用则进入下一步获取设备信息,不可用则稍后再次尝试
+        checkServer()
+    }
+
+    private fun reload() {
+        tv_local_ip.text = "本机IP: " + NetHelper.getInstance().localIP + ", server: " + serverIp
+
+        handler.postDelayed({
+            presenter.loadData(Constants.mac!!)
+        }, 20000)
+    }
+
+    private fun requestPermissions(){
+        Observable.just("").compose(
+            RxPermissions(this).ensure(
+                Manifest.permission.CAMERA,
+                Manifest.permission.READ_EXTERNAL_STORAGE,
+                Manifest.permission.WRITE_EXTERNAL_STORAGE,
+                Manifest.permission.ACCESS_WIFI_STATE,
+                Manifest.permission.RECORD_AUDIO,
+                Manifest.permission.READ_PHONE_STATE
+            )
+        ).subscribe {
+            if (it){
+                Log.e(TAG,"拿到APP所有权限")
+                permissionGranted()
+            }else{
+                showMessage("请重新授权,进入App")
+                requestPermissions()
+            }
+        }.joinManager(disposableManager)
+    }
+
+    private fun checkServer() {
+        Thread {
+            while (!serverSuccess) {
+                val okHttpClient = OkHttpClient().newBuilder()
+                    .connectTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
+                    .readTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
+                    .writeTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
+                    .build()
+                val url: String = CommonUtils.getUrl(BaseApplication.appContext)
+                val port: String = CommonUtils.getUrlPort(BaseApplication.appContext)
+                val request = Request.Builder()
+                    .url("http://$url:$port/ncs_url/server_info")
+                    .get()
+                    .build()
+
+                try {
+                    val response = okHttpClient.newCall(request).execute()
+                    if (response != null && response.isSuccessful) {
+                        //接口数据获取成功,进入下一步获取设备信息
+                        serverSuccess = true
+                        presenter.loadData(Constants.mac!!)
+                    } else {
+                        //接口数据获取失败,可能服务器ip不对,尝试重新获取服务器ip
+                        val info = ServerInfoUtil.get(Constants.mac!!)
+                        checkServerInfo(info)
+                    }
+                } catch (e: Exception) {
+                    //接口数据获取失败,可能服务器ip不对,尝试重新获取服务器ip
+                    val info = ServerInfoUtil.get(Constants.mac!!)
+                    checkServerInfo(info)
+                    //e.printStackTrace()
+                }
+
+                try {
+                    Thread.sleep(30000)
+                } catch (ex: Exception) {
+                    ex.printStackTrace()
+                }
+            }
+        }.start()
+    }
+
+    private fun checkServerInfo(info: ThirdServerInfo?) {
+        //检查获取到的服务器ip是否可用,可用则重启app重新初始化,不可用则什么都不做,等待下次重新获取服务器ip
+        if (info != null) {
+            if (info.thirdServer == null || info.thirdServerPort == null) {
+                Log.d(TAG, "server info data null")
+                showMsgMain("get server data null")
+            } else {
+                val okHttpClient = OkHttpClient().newBuilder()
+                    .connectTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
+                    .readTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
+                    .writeTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
+                    .build()
+                val request = Request.Builder()
+                    .url("http://${info.thirdServer}:${info.thirdServerPort}/ncs_url/server_info")
+                    .get()
+                    .build()
+
+                try {
+                    val response = okHttpClient.newCall(request).execute()
+                    if (response != null && response.isSuccessful) {
+                        //接口数据获取成功,稍后重启app
+                        serverSuccess = true
+                        CommonUtils.setUrl(activity, info.thirdServer)
+                        CommonUtils.setUrlPort(activity, info.thirdServerPort.toString())
+                        showMsgMain("restart...")
+                        handler.postDelayed({
+                            if (!cancelRestart) {
+                                AppUpdateHelper.restartApp(activity)
+                            }
+                        }, 10000)
+                    }
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                    showMsgMain("server error or net error")
+                }
+            }
+        } else {
+            Log.d(TAG, "server info null")
+            showMsgMain("get server null")
+        }
+    }
+
+    private fun showMsgMain(msg: String) {
+        runOnUiThread {
+            showMessage(msg)
+        }
+    }
+
+    /**
+     *显示数据
+     */
+    override fun showData(data : NurseDeviceInfoVO) {
+        Log.e(TAG,"收到返回的设备信息 "+data.hospitalName)
+        Log.e(TAG,"收到返回的设备信息 "+data.partName)
+        Log.e(TAG,"收到返回的设备信息 "+data.partId)
+        Log.e(TAG,"收到返回的设备信息 "+data.id)
+        Log.e(TAG,"收到返回的设备信息 "+data.sipId)
+        Log.e(TAG,"收到返回的设备信息 "+data.toString())
+//        Constants.mac = "e8:11:ca:03:0d:fb"
+        Constants.hospital_name = data.hospitalName
+        Constants.part_name = data.partName
+        Constants.partDisplay = data.partDisplay
+        Constants.part_id = data.partId
+        Constants.ids = data.id
+        Constants.sip_id = data.sipId
+        Constants.eth_ip = data.ethIp
+
+        Constants.DEVICE_CODE = data.code
+        Constants.DEVICE_MODEL =  data.model
+        Constants.DEVICE_HARD_VER =  data.hardVer
+        Constants.DEVICE_SOFT_VER = data.softVer
+        if (data.deviceType != null) {
+            Constants.DEVICE_TYPE = data.deviceType
+        }
+        if (data.name != null) {
+            Constants.DEVICE_NAME = data.name
+        }
+        if (data.backupId != null) {
+            Constants.back_id = data.backupId
+        }
+
+        if(TextUtils.isEmpty(data.partId.toString())|| TextUtils.isEmpty(data.id.toString())
+                || TextUtils.isEmpty(data.sipId)){
+            feedback_device_info_tv.text = "服务器返回初始化数据不全,请联系管理员"
+            showMessage("服务器返回数据不全,请联系管理员")
+            reload()
+            return
+        } else if (data.status != null && data.status == 0) {
+            feedback_device_info_tv.text = "设备未启用"
+            showMessage("设备未启用")
+            reload()
+            return
+        }
+
+        handler.removeCallbacksAndMessages(null)
+
+        AppTool.Time.delay(1000) {
+            push("/nursehome/main")
+            finish()
+        }
+    }
+
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+        btn_reload.isEnabled = false
+        btn_reload.setOnClickListener {
+            btn_reload.isEnabled = false
+            presenter.loadData(Constants.mac!!)
+        }
+
+        btn_get_server.setOnClickListener {
+            btn_get_server.isEnabled = false
+            Thread {
+                val info = ServerInfoUtil.get(Constants.mac!!)
+                runOnUiThread {
+                    btn_get_server.isEnabled = true
+                    if (info != null) {
+                        Log.d(TAG, "server info-" + info.thirdServer)
+                        showMessage("返回结果: ${info.thirdServer}")
+                        tv_local_ip.text = "本机IP: ${NetHelper.getInstance().localIP}, server: ${info.thirdServer}"
+                    } else {
+                        Log.d(TAG, "server info null")
+                        showMessage("返回结果: null")
+                    }
+                }
+
+                if (info != null && info.thirdServer != null && info.thirdServerPort != null) {
+                    CommonUtils.setUrl(activity, info.thirdServer)
+                    CommonUtils.setUrlPort(activity, info.thirdServerPort.toString())
+                }
+            }.start()
+        }
+
+        btn_set_server.setOnClickListener {
+            cancelRestart = true
+            handler.removeCallbacksAndMessages(null)
+            ServerConfigDialogHelper.showPasswordDialog(activity)
+        }
+
+        btn_reboot.setOnClickListener {
+            cancelRestart = true
+            handler.removeCallbacksAndMessages(null)
+            AppUpdateHelper.restartApp(activity)
+        }
+    }
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+        handler.removeCallbacksAndMessages(null)
+    }
+
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+        btn_reload.isEnabled = true
+        showMessage("数据加载错误: " + message)
+        reload()
+    }
+
+    override fun onNoneNet() {
+        //Log.e(TAG,"none net ")
+        btn_reload.isEnabled = true
+        showMessage("没有网络")
+        reload()
+    }
+
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+    }
+
+}

+ 75 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/BedItemAdapter.java

@@ -0,0 +1,75 @@
+package com.wdkl.ncs.android.component.nursehome.adapter;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.wdkl.ncs.android.component.nursehome.R;
+import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO;
+
+import java.util.ArrayList;
+
+public class BedItemAdapter extends RecyclerView.Adapter<BedItemAdapter.BedViewHolder> {
+
+    private Context context;
+    private ArrayList<FrameBedVO> data;
+    private InviteClickListener inviteClickListener;
+
+    public BedItemAdapter(Context context, ArrayList<FrameBedVO> data) {
+        this.context = context;
+        this.data = data;
+    }
+
+    @Override
+    public BedViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
+        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.adapter_visit_bed, viewGroup, false);
+        BedViewHolder viewHolder = new BedViewHolder(view);
+
+        return viewHolder;
+    }
+
+    @Override
+    public void onBindViewHolder(final BedViewHolder bedViewHolder, int i) {
+        bedViewHolder.visitBed.setText(data.get(i).getFrameBed().getFullName());
+        bedViewHolder.visitName.setText(data.get(i).getCustomerName());
+        bedViewHolder.visit.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (inviteClickListener != null) {
+                    inviteClickListener.onClick(data.get(bedViewHolder.getAdapterPosition()));
+                }
+            }
+        });
+    }
+
+    @Override
+    public int getItemCount() {
+        return data.size();
+    }
+
+    public void setInvitClickListener(InviteClickListener listener) {
+        inviteClickListener = listener;
+    }
+
+
+    class BedViewHolder extends RecyclerView.ViewHolder {
+        TextView visitBed;
+        TextView visitName;
+        Button visit;
+
+        BedViewHolder(View itemView) {
+            super(itemView);
+            visitBed = itemView.findViewById(R.id.tv_visit_bed);
+            visitName = itemView.findViewById(R.id.tv_visit_name);
+            visit = itemView.findViewById(R.id.btn_visit);
+        }
+    }
+
+    public interface InviteClickListener{
+        void onClick(FrameBedVO bedVO);
+    }
+}

+ 93 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/BroadcastAdapter.kt

@@ -0,0 +1,93 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterBroadcastBinding
+import com.wdkl.ncs.android.component.nursehome.fragment.BroadcastFragment
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+
+/**
+ * 广播列表适配器
+ */
+class BroadcastAdapter(var context: BroadcastFragment, val data: ArrayList<String>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterBroadcastBinding>, String>() {
+
+
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        return LinearLayoutHelper(0, data.size)
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterBroadcastBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_broadcast)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterBroadcastBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+            binding.serialNumberTv.text = "" + (position + 1)
+
+            binding.deleteBt.setOnClickListener {
+
+
+            }
+            binding.auditionBt.setOnClickListener {
+
+            }
+            binding.playBt.setOnClickListener {
+
+            }
+            binding.suspendBt.setOnClickListener {
+
+            }
+            binding.setBt.setOnClickListener {
+//
+                context.addTheTiming(position)
+            }
+
+//            binding.addTheTimingTv.setOnClickListener{
+//                binding.setTheTimerRelalyout.addView(binding.suspendBt)
+//
+//            }
+
+
+
+
+        }
+    }
+
+
+}
+
+

+ 230 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/CallRecordsItemAdapter.kt

@@ -0,0 +1,230 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.util.Log
+import android.view.View
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterCallRecordsItemBinding
+import com.wdkl.ncs.android.component.nursehome.util.LedHelper
+import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
+import com.wdkl.ncs.android.component.nursehome.util.SpeechUtil
+import com.wdkl.ncs.android.component.nursehome.util.TimeTransition
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.model.dos.CallingHistoryDO
+import com.wdkl.ncs.android.middleware.model.vo.CallingHistoryVO
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+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.enums.DeviceTypeEnum
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import org.greenrobot.eventbus.EventBus
+
+/**
+ * 呼叫记录适配器
+ */
+class CallRecordsItemAdapter(val data:ArrayList<InteractionVO>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterCallRecordsItemBinding>,InteractionVO>(){
+     var TAG = CallRecordsItemAdapter::class.java.getSimpleName()
+
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        Log.i("abc",data.toString());
+        return LinearLayoutHelper(0,data.size)
+    }
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterCallRecordsItemBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_call_records_item)
+    }
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterCallRecordsItemBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+
+            if (itemData.createDate != null) {
+                binding.processingTimeTv.text = TimeTransition.stampToDateTime(itemData.createDate * 1000)
+            }
+            binding.partNameTv.text = itemData.partName
+
+            //探视记录
+            if (TcpType.VIDEO.name == itemData.actionType) {
+                binding.sickbedTv.text = itemData.fromFrameFullName
+                binding.nameTv.text = "探视请求"
+                binding.callStatusImagev.visibility = View.GONE
+                binding.tabImagev.setImageResource(R.drawable.lai_dian_tou_xiang_bg)
+                binding.callListReply.visibility = View.GONE
+                binding.callSosReply.visibility = View.GONE
+                return
+            }
+
+            //访客开门
+            if (TcpType.ENTRACEGUARD.name == itemData.actionType) {
+                binding.sickbedTv.text = itemData.fromDeviceName
+                binding.nameTv.text = "开门请求"
+                binding.callStatusImagev.visibility = View.GONE
+                binding.tabImagev.setImageResource(R.drawable.lai_dian_tou_xiang_bg)
+                binding.callListReply.visibility = View.GONE
+                binding.callSosReply.visibility = View.GONE
+                binding.stateText.visibility = View.VISIBLE
+                binding.stateText.text=itemData.data?.toString()
+                return
+            }
+
+            binding.stateText.visibility = View.GONE
+            //是否已处理
+            if (itemData.actionEnd != null) {
+                binding.processingTimeTv.text = TimeTransition.stampToDateTime(itemData.actionEnd * 1000)
+
+                if (TcpType.SOS.name == itemData.actionType) {
+                    //紧急呼叫已处理: 因为紧急按钮是连接在某个分机上,所以收到的紧急呼叫信息会携带该分机的信息,实际需要显示的是该房间的信息
+                    var roomNo = itemData.fromFrameFullName.substringBefore("-")
+                    //如果分机绑定了紧急按钮则加上紧急按钮名称
+                    if (itemData.fromDeviceType == DeviceTypeEnum.EMERGENCY_BUTTON.value()
+                        || itemData.fromDeviceType == DeviceTypeEnum.SIMULATE_EMERGENCY_BUTTON.value()) {
+                        roomNo = itemData.fromDeviceName
+                    }
+                    binding.sickbedTv.text = roomNo
+                    binding.nameTv.text = "紧急呼叫"
+                    binding.callStatusImagev.visibility = View.GONE
+                    binding.tabImagev.setImageResource(R.drawable.ic_sos)
+                } else if (TcpType.VOICE.name == itemData.actionType) {
+                    binding.callStatusImagev.visibility = View.VISIBLE
+                    binding.tabImagev.setImageResource(R.drawable.lai_dian_tou_xiang_bg)
+                    //判断是呼入还是呼出 1 分机到主机 2主机到分机
+                    if (itemData.actionDirectionType == 1) {
+                        binding.sickbedTv.text = itemData.fromFrameFullName
+                        binding.nameTv.text = itemData.fromMemberName
+                        binding.callStatusImagev.setImageResource(R.drawable.hu_ru_yi_jie)
+                    } else if (itemData.actionDirectionType == 2 || itemData.actionDirectionType == 3) {
+                        binding.sickbedTv.text = itemData.toFrameFullName
+                        binding.nameTv.text = itemData.toMemberName
+                        binding.callStatusImagev.setImageResource(R.drawable.hu_chu_yi_jie)
+                    }
+                } else if (TcpType.REINFORCE.name == itemData.actionType) {
+                    //增援请求
+                    val roomNo = itemData.fromFrameFullName.substringBefore("-")
+                    binding.sickbedTv.text = roomNo
+                    binding.nameTv.text = "增援请求"
+                    binding.callStatusImagev.visibility = View.GONE
+                    binding.tabImagev.setImageResource(R.drawable.lai_dian_tou_xiang_bg)
+                }
+                binding.callListReply.visibility = View.GONE
+                binding.callSosReply.visibility = View.GONE
+            } else {
+                if (TcpType.SOS.name == itemData.actionType) {
+                    //紧急呼叫未处理
+                    var roomNo = itemData.fromFrameFullName.substringBefore("-")
+                    //如果分机绑定了紧急按钮则加上紧急按钮名称
+                    if (itemData.fromDeviceType == DeviceTypeEnum.EMERGENCY_BUTTON.value()
+                        || itemData.fromDeviceType == DeviceTypeEnum.SIMULATE_EMERGENCY_BUTTON.value()) {
+                        roomNo = itemData.fromDeviceName
+                    }
+                    binding.sickbedTv.text = roomNo
+                    binding.nameTv.text = "紧急呼叫"
+                    binding.callStatusImagev.visibility = View.GONE
+                    binding.tabImagev.setImageResource(R.drawable.ic_sos)
+                    binding.callListReply.visibility = View.GONE
+                    binding.callSosReply.visibility = View.VISIBLE
+                } else if (TcpType.VOICE.name == itemData.actionType) {
+                    binding.callStatusImagev.visibility = View.VISIBLE
+                    binding.tabImagev.setImageResource(R.drawable.lai_dian_tou_xiang_bg)
+                    //判断是呼入还是呼出 1 分机到主机 2主机到分机
+                    if (itemData.actionDirectionType == 1) {
+                        binding.sickbedTv.text = itemData.fromFrameFullName
+                        binding.nameTv.text = itemData.fromMemberName
+                        binding.callStatusImagev.setImageResource(R.drawable.hu_ru_wei_jie)
+                    } else if (itemData.actionDirectionType == 2 || itemData.actionDirectionType == 3) {
+                        binding.sickbedTv.text = itemData.toFrameFullName
+                        binding.nameTv.text = itemData.toMemberName
+                        binding.callStatusImagev.setImageResource(R.drawable.hu_chu_wei_jie)
+                    }
+                    binding.callListReply.visibility = View.VISIBLE
+                    binding.callSosReply.visibility = View.GONE
+                } else if (TcpType.REINFORCE.name == itemData.actionType) {
+                    //增援请求
+                    val roomNo = itemData.fromFrameFullName.substringBefore("-")
+                    binding.sickbedTv.text = roomNo
+                    binding.nameTv.text = "增援请求"
+                    binding.callStatusImagev.visibility = View.GONE
+                    binding.tabImagev.setImageResource(R.drawable.lai_dian_tou_xiang_bg)
+                    binding.callListReply.visibility = View.GONE
+                    binding.callSosReply.visibility = View.GONE
+                }
+            }
+
+            //门口机呼叫记录
+            if (TcpType.VOICE.name == itemData.actionType && itemData.fromDeviceType != null && itemData.fromDeviceType == 3) {
+                binding.sickbedTv.text = itemData.fromFrameFullName
+                binding.nameTv.text = "门口机"
+                binding.callStatusImagev.visibility = View.GONE
+                binding.callListReply.visibility = View.GONE
+                binding.callSosReply.visibility = View.GONE
+            }
+
+            binding.callListReply.setOnClickListener {
+                if (Constants.ids != 0) {
+                    //呼出时停止语音播报及铃声
+                    SpeechUtil.getInstance().stopSpeak()
+                    RingPlayHelper.stopRingTone()
+                    if (itemData.actionDirectionType == 1 && itemData.fromDeviceId != null && itemData.fromDeviceId != Constants.ids) {
+                        if (NurseHomeActivity.checkIncomingCall(itemData.toDeviceId)) {
+                            showMessage("该设备已在呼叫列表中,请先处理")
+                        } else {
+                            VoiceUtil.startAudioCall(Constants.ids, itemData.fromDeviceId)
+                            Constants.call_type = 0
+                        }
+                    } else if (itemData.actionDirectionType == 2 && itemData.toDeviceId != null && itemData.toDeviceId != Constants.ids) {
+                        if (NurseHomeActivity.checkIncomingCall(itemData.toDeviceId)) {
+                            showMessage("该设备已在呼叫列表中,请先处理")
+                        } else {
+                            VoiceUtil.startAudioCall(Constants.ids, itemData.toDeviceId)
+                            Constants.call_type = 0
+                        }
+                    }
+                } else {
+                    showMessage("获取不到当前设备id")
+                }
+            }
+
+            binding.callSosReply.setOnClickListener {
+                if (Constants.ids != 0) {
+                    OtherUtil.cancelSosCall(Constants.ids, itemData.fromDeviceId, itemData.id)
+                    LedHelper.updateLedInfo(itemData, false, true)
+                    EventBus.getDefault().post(MessageEvent(0, Constants.EVENT_REFRESH_CALL_LIST))
+                } else {
+                    showMessage("获取不到当前设备id")
+                }
+            }
+        }
+    }
+
+}

+ 145 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/CallingItemAdapter.kt

@@ -0,0 +1,145 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.content.Context
+import android.support.v7.widget.RecyclerView
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.entity.CallingItem
+import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
+import com.wdkl.ncs.android.component.nursehome.util.SpeechUtil
+import com.wdkl.ncs.android.component.nursehome.util.TimeTransition
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import org.greenrobot.eventbus.EventBus
+
+class CallingItemAdapter : RecyclerView.Adapter<CallingItemAdapter.ParentViewHolder> {
+    private var context: Context
+    private var callingData: ArrayList<CallingItem>
+    private var updateCallback: UpdateCallback? = null
+
+    constructor(context: Context, data: ArrayList<CallingItem>) {
+        this.context = context
+        this.callingData = data
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ParentViewHolder {
+        val view = LayoutInflater.from(parent?.context).inflate(R.layout.adapter_calling_item, parent, false)
+        val viewHolder = ParentViewHolder(view)
+
+        return viewHolder
+    }
+
+    override fun onBindViewHolder(holder: ParentViewHolder?, position: Int) {
+        try {
+            val itemData = callingData.get(position).interactionVO
+            holder?.partName?.text = itemData.partName
+            holder?.callingBedName?.text = itemData.fromFrameFullName
+            holder?.callingName?.text = itemData.fromMemberName
+            if (itemData.createDate != null) {
+                holder?.callingTime?.text = TimeTransition.stampToDateTime(itemData.createDate * 1000)
+            }
+
+            holder?.callingAccept?.setOnClickListener {
+                EventBus.getDefault().post(MessageEvent(itemData, Constants.EVENT_ACCEPT_CALL))
+                removeCall(itemData)
+            }
+
+            /*holder?.callingReject?.setOnClickListener {
+                removeCall(itemData)
+            }*/
+        } catch (ex : Exception) {
+            ex.printStackTrace()
+        }
+    }
+
+    override fun getItemCount(): Int {
+        return callingData.size
+    }
+
+    fun addCall(callingItem: CallingItem) {
+        synchronized(this) {
+            NurseHomeActivity.callingList.add(callingItem)
+            updateCallList()
+        }
+    }
+
+    fun updateCallList() {
+        callingData.clear()
+        callingData.addAll(NurseHomeActivity.callingList)
+        notifyDataSetChanged()
+
+        if (updateCallback != null) {
+            updateCallback?.onUpdate()
+        }
+    }
+
+    fun removeCall(interactionVO: InteractionVO) {
+        RingPlayHelper.stopRingTone()
+        SpeechUtil.getInstance().stopSpeak()
+
+        synchronized(this) {
+            val iterator = NurseHomeActivity.callingList.iterator()
+            while (iterator.hasNext()) {
+                val it = iterator.next()
+                if (interactionVO.id.equals(it.interactionVO.id)) {
+                    iterator.remove()
+                }
+            }
+
+            updateCallList()
+        }
+    }
+
+    fun removeCallByPos(position: Int) {
+        RingPlayHelper.stopRingTone()
+        SpeechUtil.getInstance().stopSpeak()
+
+        synchronized(this) {
+            val removeItem = callingData.get(position)
+            EventBus.getDefault().post(MessageEvent(removeItem.interactionVO, Constants.EVENT_REJECT_CALL))
+            val iterator = NurseHomeActivity.callingList.iterator()
+            while (iterator.hasNext()) {
+                val it = iterator.next()
+                if (removeItem.interactionVO.id.equals(it.interactionVO.id)) {
+                    iterator.remove()
+                }
+            }
+
+            updateCallList()
+        }
+    }
+
+    fun setUpdateCallback(callBack: UpdateCallback) {
+        updateCallback = callBack
+    }
+
+
+
+    class ParentViewHolder : RecyclerView.ViewHolder {
+        var partName : TextView
+        var callingBedName : TextView
+        var callingName : TextView
+        var callingTime : TextView
+        var callingAccept : ImageView
+        var callingReject : ImageView
+
+        constructor(itemView: View): super(itemView) {
+            partName = itemView.findViewById(R.id.tv_calling_part_name)
+            callingBedName = itemView.findViewById(R.id.tv_calling_bed_name)
+            callingName = itemView.findViewById(R.id.tv_calling_custom_name)
+            callingTime = itemView.findViewById(R.id.tv_calling_time)
+            callingAccept = itemView.findViewById(R.id.btn_call_accept)
+            callingReject = itemView.findViewById(R.id.btn_call_reject)
+        }
+    }
+
+    interface UpdateCallback {
+        fun onUpdate()
+    }
+}

+ 100 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/CostItemAdapter.kt

@@ -0,0 +1,100 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.content.Context
+import android.support.v7.widget.LinearLayoutManager
+import android.support.v7.widget.RecyclerView
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.middleware.model.dto.FeeConfigByGroupNameDto
+import com.wdkl.ncs.android.middleware.model.dto.FeeConfigDto
+
+class CostItemAdapter : RecyclerView.Adapter<CostItemAdapter.ParentViewHolder> {
+
+    private var context: Context
+    private var mainData: ArrayList<FeeConfigByGroupNameDto>
+
+    constructor(context: Context, data: ArrayList<FeeConfigByGroupNameDto>) {
+        this.context = context
+        this.mainData = data
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ParentViewHolder {
+        val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_cost_main_view, parent, false)
+        val viewHolder = ParentViewHolder(view)
+
+        return viewHolder
+    }
+
+    override fun onBindViewHolder(holder: ParentViewHolder?, position: Int) {
+        holder?.costGroupName?.text = mainData.get(position).feeGroupName
+        holder?.costGroupTotal?.text = "小计: ¥" + mainData.get(position).subtotal
+
+        val layoutManager = LinearLayoutManager(context)
+        holder?.costDetail?.layoutManager = layoutManager
+        holder?.costDetail?.adapter = CostDetailAdapter(mainData.get(position).feeConfigList)
+    }
+
+    override fun getItemCount(): Int {
+        return mainData.size
+    }
+
+    fun updateData(data: ArrayList<FeeConfigByGroupNameDto>) {
+        mainData = data
+        notifyDataSetChanged()
+    }
+
+    class ParentViewHolder : RecyclerView.ViewHolder {
+        var costGroupName : TextView
+        var costGroupTotal : TextView
+        var costDetail : RecyclerView
+
+        constructor(itemView: View): super(itemView) {
+            costGroupName = itemView.findViewById(R.id.tv_cost_group_name)
+            costGroupTotal = itemView.findViewById(R.id.tv_cost_group_total)
+            costDetail = itemView.findViewById(R.id.rv_cost_detail)
+        }
+    }
+
+    class CostDetailAdapter : RecyclerView.Adapter<CostDetailAdapter.ChildViewHolder> {
+        private var costData: List<FeeConfigDto>
+
+        constructor(data: List<FeeConfigDto>) {
+            costData = data
+        }
+
+        override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ChildViewHolder {
+            val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_cost_detail, parent, false)
+            val viewHolder = ChildViewHolder(view)
+
+            return viewHolder
+        }
+
+        override fun onBindViewHolder(holder: ChildViewHolder?, position: Int) {
+            holder?.costName?.text = costData.get(position).feeName
+            holder?.costValue?.text = "¥" + costData.get(position).feeValue
+            holder?.costId?.text = costData.get(position).feeKeyCode
+            holder?.costUnit?.text = costData.get(position).feeUnit
+        }
+
+        override fun getItemCount(): Int {
+            return costData.size
+        }
+
+        class ChildViewHolder : RecyclerView.ViewHolder {
+            var costName : TextView
+            var costValue : TextView
+            var costId : TextView
+            var costUnit : TextView
+
+            constructor(item : View) : super(item) {
+                costName = item.findViewById(R.id.tv_item_cost_name)
+                costValue = item.findViewById(R.id.tv_item_cost_value)
+                costId = item.findViewById(R.id.tv_item_cost_id)
+                costUnit = item.findViewById(R.id.tv_item_cost_unit)
+            }
+        }
+    }
+}

+ 76 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/DoctorHostAdapter.kt

@@ -0,0 +1,76 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.GridLayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterDoctorHostBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.lib.utils.then
+import com.wdkl.ncs.android.middleware.model.vo.FrameRoomVO
+/**
+ * 医生机适配器
+ */
+class DoctorHostAdapter(val data:ArrayList<String>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterDoctorHostBinding>, String>(){
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+//        return LinearLayoutHelper(0,data.size)
+        return GridLayoutHelper(2).then {
+            self ->
+            /**取消自动填充*/
+            self.setAutoExpand(false)
+
+            /**设置左右间距*/
+            self.hGap = 10
+
+            /**设置上下间距*/
+            self.vGap = 10
+
+            /**设置Margin*/
+            self.setMargin(0,10,0,0)
+        }
+
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterDoctorHostBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_doctor_host)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterDoctorHostBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+            binding.doctorNameTv.text = itemData.toString()
+        }
+    }
+
+
+}

+ 100 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/ExamAdapter.kt

@@ -0,0 +1,100 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.content.Context
+import android.support.v7.widget.LinearLayoutManager
+import android.support.v7.widget.RecyclerView
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.util.TimeTransition
+import com.wdkl.ncs.android.middleware.model.dto.ExaminationConfigByGroupNameDto
+import com.wdkl.ncs.android.middleware.model.dto.ExaminationConfigDto
+
+class ExamAdapter :RecyclerView.Adapter<ExamAdapter.ParentViewHolder>{
+
+    private var context: Context
+    private var data: ArrayList<ExaminationConfigByGroupNameDto>
+
+    constructor(context: Context, data: ArrayList<ExaminationConfigByGroupNameDto>) {
+        this.context = context
+        this.data = data
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ParentViewHolder {
+        val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_exam_main_view, parent, false)
+        val viewHolder = ParentViewHolder(view)
+
+        return viewHolder
+    }
+
+    override fun onBindViewHolder(holder: ParentViewHolder?, position: Int) {
+        holder?.examGroupName?.text = this.data.get(position).examinationGroupName
+
+        val layoutManager = LinearLayoutManager(context)
+        holder?.examDetail?.layoutManager = layoutManager
+        holder?.examDetail?.adapter = ExamDetailAdapter(this.data.get(position).examinationConfigList)
+    }
+
+    override fun getItemCount(): Int {
+        return this.data.size
+    }
+
+    fun updateData(data: ArrayList<ExaminationConfigByGroupNameDto>) {
+        this.data = data
+        notifyDataSetChanged()
+    }
+
+    class ParentViewHolder : RecyclerView.ViewHolder {
+        var examGroupName : TextView
+        var examDetail : RecyclerView
+
+        constructor(itemView: View): super(itemView) {
+            examGroupName = itemView.findViewById(R.id.tv_exam_group_name)
+            examDetail = itemView.findViewById(R.id.rv_exam_detail)
+        }
+    }
+
+
+    //子项
+    class ExamDetailAdapter : RecyclerView.Adapter<ExamDetailAdapter.ChildViewHolder> {
+        private var examData: List<ExaminationConfigDto>
+
+        constructor(data: List<ExaminationConfigDto>) {
+            examData = data
+        }
+
+        override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ChildViewHolder {
+            val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_exam_detail, parent, false)
+            val viewHolder = ChildViewHolder(view)
+
+            return viewHolder
+        }
+
+        override fun onBindViewHolder(holder: ChildViewHolder?, position: Int) {
+            holder?.examName?.text = examData.get(position).examinationName
+            holder?.examValue?.text = examData.get(position).examinationValue
+            holder?.examDesc?.text = "描述: " + examData.get(position).examinationDescription
+            holder?.examTime?.text = "检验时间: " + TimeTransition.stampToDateTime(examData.get(position).examinationTime * 1000)
+        }
+
+        override fun getItemCount(): Int {
+            return examData.size
+        }
+
+        class ChildViewHolder : RecyclerView.ViewHolder {
+            var examName : TextView
+            var examValue : TextView
+            var examDesc : TextView
+            var examTime : TextView
+
+            constructor(item : View) : super(item) {
+                examName = item.findViewById(R.id.tv_item_exam_name)
+                examValue = item.findViewById(R.id.tv_item_exam_value)
+                examDesc = item.findViewById(R.id.tv_item_exam_desc)
+                examTime = item.findViewById(R.id.tv_item_exam_time)
+            }
+        }
+    }
+}

+ 68 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/FrameBedVosAdapter.kt

@@ -0,0 +1,68 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.util.Log
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterFrameBedVosBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO
+
+/**
+ * 首页病房适配器
+ */
+class FrameBedVosAdapter(val data:ArrayList<FrameBedVO>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterFrameBedVosBinding>,FrameBedVO>(){
+    var TAG = FrameBedVosAdapter::class.java.getSimpleName()
+
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        Log.i("FrameBedVosAdapter",""+data.size)
+        return LinearLayoutHelper(0,data.size)
+    }
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterFrameBedVosBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_frame_bed_vos)
+    }
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterFrameBedVosBinding>?, position: Int) {
+        holder?.bind {
+            binding ->
+
+
+            val itemData = getItem(position)
+//            binding.nameTv.text = itemData.customerName
+
+
+            Log.e("FrameBedVosAdapter ","FrameBedVosAdapter...."+itemData.customerName)
+//            binding.nameTv.text = itemData.frameRoom.name
+
+
+        }
+    }
+}

+ 120 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/FrameBedVosConfinementAdapter.kt

@@ -0,0 +1,120 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.graphics.Color
+import android.text.TextUtils
+import android.util.Log
+import android.view.View
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.GridLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterHospitalFramePartBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.lib.utils.then
+import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO
+
+
+class FrameBedVosConfinementAdapter(val data: ArrayList<FrameBedVO>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterHospitalFramePartBinding>, FrameBedVO>() {
+    var TAG = FrameBedVosConfinementAdapter::class.java.getSimpleName()
+
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        Log.i("FrameBedVosAdapter", "" + data.size)
+//        return LinearLayoutHelper(0,data.size)
+        return GridLayoutHelper(3).then { self ->
+            /**取消自动填充*/
+            self.setAutoExpand(false)
+
+            /**设置左右间距*/
+            self.hGap = 10
+
+            /**设置上下间距*/
+            self.vGap = 10
+
+            /**设置Margin*/
+            self.setMargin(0, 10, 0, 0)
+        }
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterHospitalFramePartBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_hospital_frame_part)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterHospitalFramePartBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+            if (itemData.customerName != null) {
+                binding.patientNameTv.text = itemData.customerName
+            } else {
+                binding.patientImagev.setImageResource(R.drawable.kong_chuang)
+                binding.patientNameTv.text = "空床位"
+            }
+
+            if (itemData.customerAge != null) {
+                binding.patientAgeTv.text = itemData.customerAge.toString() + itemData.customerAgeUnit
+            } else {
+                binding.patientAgeTv.text = "--"
+            }
+
+            if (itemData.nurseConfigDtos != null && itemData.nurseConfigDtos.size > 0) {
+                val nurseItem = itemData.nurseConfigDtos.get(0)
+                binding.tvNurseConfigName.text = nurseItem.nurseConfigName
+                if (!TextUtils.isEmpty(nurseItem.nurseColorRbg)) {
+                    binding.tvNurseConfigColor.visibility = View.VISIBLE
+                    binding.tvNurseConfigColor.setBackgroundColor(Color.parseColor("#" + nurseItem.nurseColorRbg))
+                    binding.tvNurseConfigColor.text = nurseItem.nurseOptionName
+                } else {
+                    binding.tvNurseConfigColor.visibility = View.INVISIBLE
+                }
+            } else {
+                binding.tvNurseConfigName.text = ""
+                binding.tvNurseConfigColor.visibility = View.INVISIBLE
+            }
+
+            if (itemData.customerSex != null) {
+                binding.sexImagev.visibility = View.VISIBLE
+                if (itemData.customerSex == 1) {
+                    binding.sexImagev.setImageResource(R.drawable.man)
+                    binding.patientImagev.setImageResource(R.drawable.bing_ren_xiang_qing_man)
+                } else {
+                    binding.sexImagev.setImageResource(R.drawable.nv)
+                    binding.patientImagev.setImageResource(R.drawable.bing_ren_xiang_qing)
+                }
+            } else {
+                binding.sexImagev.visibility = View.GONE
+            }
+            binding.roomNumberTv.text = itemData.frameBed.fullName
+            //Log.e("FrameBedVosAdapter ", "FrameBedVosAdapter...." + itemData.customerName)
+        }
+    }
+}

+ 128 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/FramePartItemAdapter.kt

@@ -0,0 +1,128 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.content.Context
+import android.util.Log
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterFramePartItemBinding
+import com.wdkl.ncs.android.component.nursehome.fragment.FramePartFragment
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.middleware.model.vo.FrameRoomVO
+
+/**
+ * 首页病床适配器
+ */
+class FramePartItemAdapter(var context: Context, var mListener: FramePartFragment.OnItemListener?,
+                           val data:ArrayList<FrameRoomVO>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterFramePartItemBinding>,FrameRoomVO>(){
+var TAG = FramePartItemAdapter::class.java.getSimpleName()
+
+    private lateinit var virtualLayoutManager2: VirtualLayoutManager
+    private lateinit var delegateAdapter2: DelegateAdapter
+    var frameBedVosAdapter:FrameBedVosAdapter? = null
+
+
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        Log.i("abc",data.toString());
+        return LinearLayoutHelper(0,data.size)
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterFramePartItemBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_frame_part_item)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterFramePartItemBinding>?, position: Int) {
+        holder?.bind {
+            binding ->
+            val itemData = getItem(position)
+            binding.wardTv.text = itemData.frameRoom.name
+
+
+            var frameBedVos =  itemData.frameBedList
+//            if(frameBedVos!= null){
+//                Log.e("frameBedVOs","frameBedVOs "+frameBedVos.size)
+//            }
+
+//            Log.e("frameBedVOs","frameBedVOs ")
+
+            Log.e("frameBedVOs","frameBedVOs "+frameBedVos.size)
+              if(frameBedVos.size>0){
+            //病床
+            /**初始化LayoutMannager*/
+            virtualLayoutManager2 = VirtualLayoutManager(context)
+            virtualLayoutManager2.setOrientation(VirtualLayoutManager.HORIZONTAL)
+            frameBedVosAdapter = FrameBedVosAdapter(ArrayList())
+            /**初始化适配器*/
+            delegateAdapter2 = DelegateAdapter(virtualLayoutManager2)
+            delegateAdapter2.addAdapter(frameBedVosAdapter)
+
+
+            /**配置到RecycleView*/
+            binding.sickbedRev.layoutManager = virtualLayoutManager2
+            binding.sickbedRev.adapter = delegateAdapter2
+
+            frameBedVosAdapter!!.data.clear()
+                  Log.e("frameBedVOs","frameBedVOs "+frameBedVos.size)
+            frameBedVosAdapter!!.data.addAll(frameBedVos)
+            frameBedVosAdapter!!.notifyDataSetChanged()
+
+//                  val recyclerView = holder.getBinding().sickbedRev as RecyclerView
+//                  val linearLayoutManager = LinearLayoutManager(context)
+//                  linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL)
+//                  recyclerView.setLayoutManager(linearLayoutManager)
+//                  val frameBedVosAdapter = FrameBedVosAdapter(ArrayList())
+//                  recyclerView.setAdapter(frameBedVosAdapter)
+//
+//                  frameBedVosAdapter.data.clear()
+//                  Log.e("frameBedVOs","frameBedVOs "+frameBedVos.size)
+//                  frameBedVosAdapter.data.addAll(frameBedVos)
+//                  frameBedVosAdapter.notifyDataSetChanged()
+
+                  frameBedVosAdapter!!.setOnItemClickListener { data, position ->
+//                       showMessage("点击了。。。frameBedVosAdapter。")
+                      Log.e("frameBedVosAdapter","frameBedVosAdapter..... ")
+                      mListener?.theBedInformation(data)
+                  }
+              }
+
+        }
+    }
+
+
+
+
+}

+ 77 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/HostDeviceAdapter.kt

@@ -0,0 +1,77 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.support.v7.widget.RecyclerView
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.LinearLayout
+import android.widget.TextView
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.middleware.model.dos.DeviceDO
+
+class HostDeviceAdapter(private var devices: ArrayList<DeviceDO>): RecyclerView.Adapter<HostDeviceAdapter.ViewHolder>() {
+
+    private var clickListener: OnHostClickListener?=null
+    private var clickPos = 0
+
+    override fun onCreateViewHolder(p0: ViewGroup?, p1: Int): ViewHolder {
+        val view = LayoutInflater.from(p0?.context).inflate(R.layout.adapter_host_device, p0, false)
+        return ViewHolder(view)
+    }
+
+    override fun onBindViewHolder(p0: ViewHolder?, p1: Int) {
+        //Log.d("hostdevice", "device name: " + devices.get(p1).name)
+        if (p1 == clickPos) {
+            p0?.hostItem?.setBackgroundResource(R.color.color_gray)
+        } else {
+            p0?.hostItem?.setBackgroundResource(R.color.white)
+        }
+        p0?.hostName?.text = devices[p1].name
+
+        p0?.hostItem?.setOnClickListener {
+            if (clickListener != null) {
+                clickPos = p0.adapterPosition
+                clickListener!!.onItemClick(devices[p1])
+                notifyDataSetChanged()
+            }
+        }
+
+        p0?.hostCall?.setOnClickListener {
+            if (clickListener != null) {
+                clickListener!!.onCallClick(devices[p1])
+            }
+        }
+    }
+
+    fun setSelectHost(pos: Int) {
+        clickPos = pos
+    }
+
+    override fun getItemCount(): Int {
+        return devices.size
+    }
+
+    fun updateData(data: ArrayList<DeviceDO>) {
+        this.devices = data
+        notifyDataSetChanged()
+    }
+
+    class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+        val hostName: TextView = itemView.findViewById(R.id.tv_host_device_name)
+        val hostItem: LinearLayout = itemView.findViewById(R.id.ll_host_device_item)
+        val hostCall: ImageView = itemView.findViewById(R.id.btn_host_call)
+    }
+
+
+    //点击事件接口回调
+    fun setOnClickListener(listener: OnHostClickListener){
+        clickListener = listener
+    }
+
+    interface OnHostClickListener{
+        fun onItemClick(device: DeviceDO)
+        fun onCallClick(device: DeviceDO)
+    }
+}

+ 44 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/InpatientWardAdapter.kt

@@ -0,0 +1,44 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterCallRecordsItemBinding
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterInpatientWardBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.middleware.model.vo.CallingHistoryVO
+
+class InpatientWardAdapter(val data:ArrayList<String>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterInpatientWardBinding>, String>(){
+
+
+    override fun dataProvider(): Any {
+        return data
+    }
+
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    override fun getItemCount(): Int {
+        return data.size
+    }
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        return LinearLayoutHelper(0,data.size)
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterInpatientWardBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_inpatient_ward)
+    }
+
+
+
+
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterInpatientWardBinding>?, position: Int) {
+        holder?.bind {
+          binding ->
+            val itemData = getItem(position)
+            binding.checkBox.text = itemData.toString()
+        }
+    }
+}

+ 51 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/LedItemAdapter.kt

@@ -0,0 +1,51 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.support.v7.widget.RecyclerView
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.led.LedItem
+
+class LedItemAdapter(private var data: ArrayList<LedItem>) : RecyclerView.Adapter<LedItemAdapter.ViewHolder>() {
+    private var clickListener: OnClickListener?=null
+    private var clickPos = -1
+
+    override fun onCreateViewHolder(p0: ViewGroup?, p1: Int): ViewHolder {
+        val view = LayoutInflater.from(p0?.context).inflate(R.layout.adapter_led_item, p0, false)
+        return ViewHolder(view)
+    }
+
+    override fun onBindViewHolder(p0: ViewHolder?, p1: Int) {
+        if (p1 == clickPos) {
+            p0?.ledName?.setBackgroundResource(R.color.main_color)
+        } else {
+            p0?.ledName?.setBackgroundResource(R.color.white)
+        }
+        p0?.ledName?.setText(data.get(p1).ip)
+        p0?.ledName?.setOnClickListener {
+            if (clickListener != null) {
+                clickListener?.onClick(data.get(p1))
+                clickPos = p0.adapterPosition
+                notifyDataSetChanged()
+            }
+        }
+    }
+
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+        var ledName : TextView = itemView.findViewById(R.id.tv_led_name)
+    }
+
+    fun setOnItemClickListener(listener: OnClickListener){
+        clickListener = listener
+    }
+
+    interface OnClickListener{
+        fun onClick(item: LedItem)
+    }
+}

+ 56 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/NumAdapter.java

@@ -0,0 +1,56 @@
+package com.wdkl.ncs.android.component.nursehome.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+import com.wdkl.ncs.android.component.nursehome.R;
+
+public class NumAdapter extends BaseAdapter {
+    private String[] num;
+    private Context context;
+
+    public NumAdapter(String[] numbers, Context context) {
+        this.num = numbers;
+        this.context = context;
+    }
+
+
+    @Override
+    public int getCount() {
+        return num.length;
+    }
+
+    @Override
+    public Object getItem(int position) {
+        return num[position];
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        ViewHolder viewHolder;
+        if (convertView == null) {
+            convertView = LayoutInflater.from(context).inflate(R.layout.digital_item, null);
+            viewHolder = new ViewHolder();
+            viewHolder.numTv = convertView.findViewById(R.id.tv_number);
+            convertView.setTag(viewHolder);
+        } else {
+            viewHolder = (ViewHolder) convertView.getTag();
+        }
+        viewHolder.numTv.setText(num[position]);
+
+        return convertView;
+    }
+
+    static class ViewHolder {
+        TextView numTv;
+    }
+}

+ 70 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/NurseMoveAdapter.kt

@@ -0,0 +1,70 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.GridLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterDoctorHostBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.lib.utils.then
+
+class NurseMoveAdapter(val data:ArrayList<String>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterDoctorHostBinding>, String>(){
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+//        return LinearLayoutHelper(0,data.size)
+        return GridLayoutHelper(2).then {
+            self ->
+            /**取消自动填充*/
+            self.setAutoExpand(false)
+
+            /**设置左右间距*/
+            self.hGap = 10
+
+            /**设置上下间距*/
+            self.vGap = 10
+
+            /**设置Margin*/
+            self.setMargin(0,10,0,0)
+        }
+
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterDoctorHostBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_doctor_host)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterDoctorHostBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+            binding.doctorNameTv.text = itemData.toString()
+        }
+    }
+}

+ 74 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/OtherHostAdapter.kt

@@ -0,0 +1,74 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.GridLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterDoctorHostBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.lib.utils.then
+
+/**
+ * 其它主机适配器
+ */
+class OtherHostAdapter (val data:ArrayList<String>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterDoctorHostBinding>, String>(){
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+//        return LinearLayoutHelper(0,data.size)
+        return GridLayoutHelper(2).then {
+            self ->
+            /**取消自动填充*/
+            self.setAutoExpand(false)
+
+            /**设置左右间距*/
+            self.hGap = 10
+
+            /**设置上下间距*/
+            self.vGap = 10
+
+            /**设置Margin*/
+            self.setMargin(0,10,0,0)
+        }
+
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterDoctorHostBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_doctor_host)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterDoctorHostBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+            binding.doctorNameTv.text = itemData.toString()
+        }
+    }
+
+}

+ 71 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/ResponsibilityBedAdapter.kt

@@ -0,0 +1,71 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.GridLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterResponsibilityBedBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.lib.utils.then
+
+/**
+ * 医生负责的床位适配器
+ */
+class ResponsibilityBedAdapter(val data:ArrayList<String>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterResponsibilityBedBinding>, String>(){
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        return GridLayoutHelper(2).then { self ->
+            /**取消自动填充*/
+            self.setAutoExpand(false)
+
+            /**设置左右间距*/
+            self.hGap = 10
+
+            /**设置上下间距*/
+            self.vGap = 10
+
+            /**设置Margin*/
+            self.setMargin(0, 10, 0, 0)
+        }
+    }
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterResponsibilityBedBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_responsibility_bed)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterResponsibilityBedBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+            binding.responsibilityBedTv.text = itemData.toString()
+        }
+
+    }
+
+
+}

+ 58 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/SickbedAdapter.kt

@@ -0,0 +1,58 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.content.Context
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterSickbedBinding
+import com.wdkl.ncs.android.component.nursehome.fragment.FramePartFragment
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.middleware.model.vo.FrameRoomVO
+
+class SickbedAdapter(var context: Context, var mListener: FramePartFragment.OnItemListener?,
+                     val data:ArrayList<FrameRoomVO>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterSickbedBinding>, FrameRoomVO>() {
+
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterSickbedBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_sickbed)
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+        return LinearLayoutHelper(0,data.size)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterSickbedBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+        }
+    }
+
+}

+ 70 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/adapter/VisitManagementAdapter.kt

@@ -0,0 +1,70 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.view.ViewGroup
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.layout.GridLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterDoctorHostBinding
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.lib.utils.then
+
+class VisitManagementAdapter(val data:ArrayList<String>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterDoctorHostBinding>, String>(){
+    /**
+     * 数据提供者
+     */
+    override fun dataProvider(): Any {
+        return data
+    }
+    /**
+     * Item坐标
+     */
+    override fun itemFilter(position: Int): Boolean {
+        return true
+    }
+    /**
+     * 获取Item总数
+     */
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    /**
+     * 创建LayoutHelper
+     */
+    override fun onCreateLayoutHelper(): LayoutHelper {
+//        return LinearLayoutHelper(0,data.size)
+        return GridLayoutHelper(2).then {
+            self ->
+            /**取消自动填充*/
+            self.setAutoExpand(false)
+
+            /**设置左右间距*/
+            self.hGap = 10
+
+            /**设置上下间距*/
+            self.vGap = 10
+
+            /**设置Margin*/
+            self.setMargin(0,10,0,0)
+        }
+
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BaseRecyclerViewHolder<AdapterDoctorHostBinding> {
+        return BaseRecyclerViewHolder.build(parent, R.layout.adapter_doctor_host)
+    }
+
+    /**
+     * 绑定数据
+     */
+    override fun onBindViewHolder(holder: BaseRecyclerViewHolder<AdapterDoctorHostBinding>?, position: Int) {
+        holder?.bind { binding ->
+            val itemData = getItem(position)
+            binding.doctorNameTv.text = itemData.toString()
+        }
+    }
+}

+ 104 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/agreement/FloorActionAgreement.kt

@@ -0,0 +1,104 @@
+//package com.wdkl.ncs.android.component.home.agreement
+//
+//import android.view.MenuItem
+//import android.view.View
+//import com.wdkl.ncs.android.middleware.model.BannerModel
+//import com.wdkl.ncs.android.middleware.model.FloorItem
+//import com.wdkl.ncs.android.middleware.model.FloorMenuModel
+//
+///**
+// * Created by LDD on 2018/10/16.
+// */
+//interface FloorActionAgreement {
+//
+//    fun pointMall()
+//
+//    fun secKill()
+//
+//    fun groupMall()
+//
+//    fun couponHall()
+//
+//    fun toShop(id :Int)
+//
+//    fun toWeb(url :String)
+//
+//    fun searchGoodsForKeyWord(keyword :String)
+//
+//    fun searchGoodsForCatrgory(catId :Int,text :String)
+//
+//    fun goods(goodsId :Int)
+//
+//    fun floorHandle(view :View , item :Any){
+//
+//        view.setOnClickListener {
+//            event(item)
+//        }
+//
+//    }
+//
+//    fun event(item :Any){
+//        if (item is BannerModel){
+//            if(item.action == "URL"){
+//                if(item.value.contains("point")){
+//                    pointMall()
+//                }else if(item.value.contains("group")){
+//                    groupMall()
+//                }else if(item.value.contains("sec")){
+//                    secKill()
+//                }else{
+//                    toWeb(item.value)
+//                }
+//            }else if(item.action == "KEYWORD"){
+//                searchGoodsForKeyWord(item.value)
+//            }else if(item.action == "GOODS"){
+//                goods(item.value.toInt())
+//            }else if(item.action == "CATEGORY"){
+//                searchGoodsForCatrgory(item.value.toInt(),"搜索结果")
+//            }else if(item.action == "SHOP"){
+//                toShop(item.value.toInt())
+//            }
+//        }
+//        if (item is FloorItem){
+//            if(item.opt!!.type == "URL"){
+//                if(item.opt!!.value.contains("point")){
+//                    pointMall()
+//                }else if(item.opt!!.value.contains("group")){
+//                    groupMall()
+//                }else if(item.opt!!.value.contains("sec")){
+//                    secKill()
+//                }else{
+//                    toWeb(item.opt!!.value)
+//                }
+//            }else if(item.opt!!.type == "KEYWORD"){
+//                searchGoodsForKeyWord(item.opt!!.value)
+//            }else if(item.opt!!.type == "GOODS"){
+//                goods(item.opt!!.value.toInt())
+//            }else if(item.opt!!.type == "CATEGORY"){
+//                searchGoodsForCatrgory(item.opt!!.value.toInt(),"搜索结果")
+//            }else if(item.opt!!.type == "SHOP"){
+//                toShop(item.opt!!.value.toInt())
+//            }
+//        }
+//        if (item is FloorMenuModel){
+//            if (item.action.contains("points-mall")){
+//                pointMall()
+//            }else if (item.action.contains("group-buy")){
+//                groupMall()
+//            }else if (item.action.contains("seckill")){
+//                secKill()
+//            }else if (item.action.contains("goods")){
+//                goods(item.action.removePrefix("/goods/").toInt())
+//            }else if(item.action.contains("coupons")){
+//                couponHall()
+//            }else{
+//                toWeb(item.action)
+//            }
+//        }
+//    }
+//
+//
+//
+//
+//
+//}

+ 32 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/di/NurseHomeComponent.kt

@@ -0,0 +1,32 @@
+package com.wdkl.ncs.android.component.nursehome.di
+
+import com.wdkl.ncs.android.component.nursehome.activity.AppUpdateActivity
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.activity.RegisterActivity
+import com.wdkl.ncs.android.component.nursehome.fragment.*
+import com.wdkl.ncs.android.middleware.di.ApplicationComponent
+import dagger.Component
+
+/**
+ * 依赖注入入口
+ */
+@Component(dependencies = arrayOf(ApplicationComponent::class))
+interface NurseHomeComponent{
+    fun inject(activity: RegisterActivity)
+    fun inject(activity: NurseHomeActivity)
+    fun inject(activity: FramePartFragment)
+    fun inject(activity: BroadcastFragment)
+    fun inject(activity: VisitManagementFragment)
+    fun inject(activity: DoctorHostFragment)
+    fun inject(activity: BedsInTheWardFragment)
+    fun inject(activity: SickbedFragment)
+    fun inject(activity: NurseMoveFragment)
+    fun inject(activity: OtherHostFragment)
+
+    fun inject(activity: TrustManagementFragment)
+    fun inject(activity: SystemSettingsFragment)
+
+    fun inject(activity: CallRecordsFragment)
+    fun inject(activity: InpatientWardFragment)
+    fun inject(activity: AppUpdateActivity)
+}

+ 29 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/entity/CallingItem.java

@@ -0,0 +1,29 @@
+package com.wdkl.ncs.android.component.nursehome.entity;
+
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO;
+
+public class CallingItem {
+    private long startTime;
+    private InteractionVO interactionVO;
+
+    public CallingItem(long startTime, InteractionVO interactionVO) {
+        this.startTime = startTime;
+        this.interactionVO = interactionVO;
+    }
+
+    public long getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(long startTime) {
+        this.startTime = startTime;
+    }
+
+    public InteractionVO getInteractionVO() {
+        return interactionVO;
+    }
+
+    public void setInteractionVO(InteractionVO interactionVO) {
+        this.interactionVO = interactionVO;
+    }
+}

+ 104 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/BaseCallFragment.kt

@@ -0,0 +1,104 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.os.Bundle
+import android.support.v4.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.enation.javashop.utils.base.tool.BaseToolActivity
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import org.greenrobot.eventbus.EventBus
+
+abstract class BaseCallFragment: Fragment() {
+
+    private var layout: View? = null
+
+    protected lateinit var baseActivity: BaseToolActivity
+
+    //通话状态:0-去电, 1-来电
+    protected var callState : Int = 0
+    protected var onlyAudio: Boolean = true
+
+    protected var targetId: String? = null
+    //是否探视
+    protected var visiting: Boolean = false
+    //呼叫名称
+    protected var callName: String? = null
+
+    //protected var gEngineKit: SkyEngineKit? = null
+
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        retainInstance = true
+        callState = arguments.getInt("call_state")
+        onlyAudio = arguments.getBoolean("audio_only")
+        targetId = arguments.getString("targetId")
+        visiting = arguments.getBoolean("visiting")
+        callName = arguments.getString("call_name")
+
+    }
+
+    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+        if (layout == null) {
+            layout = inflater.inflate(getLayId(), null)
+        }
+
+        /**初始化宿主Activity*/
+        baseActivity = getActivity() as BaseToolActivity
+
+        return layout
+    }
+
+    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+
+/*        try {
+            SkyEngineKit.init(VoipEvent())
+            gEngineKit = SkyEngineKit.Instance()
+        } catch (e: NotInitializedException) {
+            SkyEngineKit.init(VoipEvent())
+            try {
+                gEngineKit = SkyEngineKit.Instance()
+            } catch (ex: NotInitializedException) {
+                ex.printStackTrace()
+                baseActivity.finish()
+            }
+        }*/
+
+        init()
+        bindEvent()
+    }
+
+    override fun onDestroyView() {
+        super.onDestroyView()
+        destroy()
+    }
+
+    override fun onStart() {
+        EventBus.getDefault().register(this)
+        super.onStart()
+    }
+
+    override fun onStop() {
+        EventBus.getDefault().unregister(this)
+        super.onStop()
+    }
+
+    protected abstract fun getLayId(): Int
+
+    protected abstract fun init()
+
+    protected abstract fun bindEvent()
+
+    protected abstract fun destroy()
+
+
+
+    //返回主界面
+    protected fun backToMain() {
+        EventBus.getDefault().post(MessageEvent("BackCall", Constants.EVENT_REMOVE_CALL_FRAGMENT))
+    }
+
+}

+ 128 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/BedsInTheWardFragment.kt

@@ -0,0 +1,128 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.scwang.smartrefresh.layout.footer.ClassicsFooter
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.FramePartItemAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentBedsInTheWardBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.BedsInTheWardContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.BedsInTheWardPresenter
+import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_beds_in_the_ward.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 病区病床Fragment
+ */
+class BedsInTheWardFragment : BaseFragment<BedsInTheWardPresenter, FragmentBedsInTheWardBinding>(), BedsInTheWardContract.View{
+    var TAG = BedsInTheWardFragment::class.java.getSimpleName()
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+    private var adapter: FramePartItemAdapter? = null
+//    var mListener: OnItemListener? = null
+
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_beds_in_the_ward
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+//        /**初始化LayoutMannager*/
+//        virtualLayoutManager = VirtualLayoutManager(this.activity)
+//
+//        /**初始化适配器*/
+//        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+//
+//        adapter = FramePartItemAdapter(this.activity,mListener,ArrayList())
+//        delegateAdapter.addAdapter(adapter)
+//        mViewDataBinding.refresh.setRefreshFooter(ClassicsFooter(activity))
+//
+//        /**配置到RecycleView*/
+//        listView.layoutManager = virtualLayoutManager
+//        listView.adapter = delegateAdapter
+
+
+    }
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+    }
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+    }
+    /**
+     *显示数据
+     */
+    override fun showData() {
+    }
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    /**
+     * 更新病区数据
+     */
+    fun updateData(data: String) {
+        showMessage(data)
+
+}
+
+//    fun setOnItemListener(mListener: OnItemListener) {
+//        this.mListener = mListener
+//    }
+//
+//    interface OnItemListener {
+//        fun theBedInformation(data: FrameBedVO)
+//    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+
+}

+ 335 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/BroadcastFragment.kt

@@ -0,0 +1,335 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.content.Context
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.widget.CompoundButton
+import android.widget.LinearLayout
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.BroadcastAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentBroadcastBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.BroadcastContract
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.NurseHomeActivityContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.BroadcastPresenter
+import com.wdkl.ncs.android.middleware.model.dos.BroadcastDO
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.add_the_timing.*
+import kotlinx.android.synthetic.main.add_the_timing.view.*
+import kotlinx.android.synthetic.main.fragment_broadcast.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 广播管理界面
+ */
+class BroadcastFragment : BaseFragment<BroadcastPresenter, FragmentBroadcastBinding>(), BroadcastContract.View, View.OnClickListener {
+    var TAG = BroadcastFragment::class.java.getSimpleName()
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+    //录音适配器
+    var broadcastAdapter: BroadcastAdapter? = null
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_broadcast
+    }
+
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    /**
+     *初始化操作
+     */
+    override fun init() {
+
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+
+        broadcastAdapter = BroadcastAdapter(this, ArrayList())
+        delegateAdapter.addAdapter(broadcastAdapter)
+
+        /**配置到RecycleView*/
+        broadcast_recyv.layoutManager = virtualLayoutManager
+        broadcast_recyv.adapter = delegateAdapter
+
+
+        //临时模拟测试数据
+        var other_hostList = ArrayList<String>()
+        other_hostList.add("录音1")
+        other_hostList.add("录音2")
+        other_hostList.add("录音3")
+        other_hostList.add("录音4")
+        other_hostList.add("录音5")
+        other_hostList.add("录音6")
+        other_hostList.add("录音7")
+        other_hostList.add("录音8")
+        other_hostList.add("录音9")
+        other_hostList.add("录音10")
+        other_hostList.add("录音11")
+
+        broadcastAdapter!!.data.clear()
+        broadcastAdapter!!.data.addAll(other_hostList)
+        Log.i(TAG, "录音数量 " + other_hostList.size)
+        broadcastAdapter!!.notifyDataSetChanged()
+
+
+    }
+
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+    }
+
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+    }
+
+    /**
+     *显示数据
+     */
+    override fun showData(data: ArrayList<BroadcastDO>) {
+    }
+
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    /**
+     *
+     */
+    fun addTheTiming(position: Int) {
+        broadcast_relayout.visibility = View.GONE
+        set_the_timer_relalyout.visibility = View.VISIBLE
+        add_the_timing_tv.setOnClickListener(this)
+    }
+    var timingViewTag =0
+    var  timingViewList = ArrayList<View>()
+    var  timingViews = ArrayList<View>()
+
+    override fun onClick(p0: View) {
+        when (p0.id) {
+            R.id.add_the_timing_tv -> {
+
+                var failedPop = LayoutInflater.from(this.activity).inflate(R.layout.add_the_timing, null)
+
+                failedPop.setTag(timingViewTag++)
+                timingViewList.add(failedPop)
+//                Log.e(TAG,"timingViewList "+timingViewList.size)
+                timing_linlyout.addView(failedPop)
+
+
+                failedPop.monday_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                        showMessage("选中周一")
+                    }else{
+
+                        showMessage("取消选中周一")
+                    }
+                }
+
+                failedPop.tuesday_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.wednesday_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.friday_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.saturday_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.week_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                //
+                failedPop.area_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+
+                failedPop.the_second_area_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.three_areas_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.the_four_areas_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.five_area_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+                failedPop.six_area_chebox.setOnCheckedChangeListener { compoundButton, b ->
+                    if(b){
+
+                    }else{
+
+                    }
+
+                }
+
+
+                /**
+                 * 立即播放按钮
+                 */
+                failedPop.play_immediately_bt.setOnClickListener{
+
+                    showMessage("ceshiaaaa"+failedPop.getTag())
+                }
+                /**
+                 * 删除按钮
+                 */
+                failedPop.delete_bt.setOnClickListener{
+                    showMessage("sssss"+failedPop.getTag())
+
+                    Log.e(TAG,"failedPop.getTag() "+failedPop.getTag())
+                    Log.e(TAG,"timingViewList "+timingViewList.size)
+
+//                    timing_linlyout.removeView(vS.get(failedPop.getTag() as Int))
+//                    vS.remove(vS.get(failedPop.getTag() as Int))
+
+                    for (timingView in timingViewList){
+                        if(timingView.getTag() == failedPop.getTag()){
+                            Log.e(TAG,"timingView.getTag() "+timingView.getTag())
+                            timingViews.add(timingView)
+                        }
+                    }
+                    timing_linlyout.removeView(timingViews.get(0))
+                    timingViewList.removeAll(timingViews)
+                    timingViews.clear()
+
+                }
+                /**
+                 * 试听按钮
+                 */
+                failedPop.audition_bt.setOnClickListener{
+
+                }
+                /**
+                 * 暂停按钮
+                 */
+                failedPop.suspend_bt.setOnClickListener{
+
+
+                }
+                /**
+                 * 保存按钮
+                 */
+                failedPop.save_bt.setOnClickListener{
+
+                }
+
+
+
+
+
+            }
+            R.id.play_immediately_bt -> {
+
+            }
+
+
+        }
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}

+ 372 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/CallRecordsFragment.kt

@@ -0,0 +1,372 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.support.v7.widget.RecyclerView
+import android.support.v7.widget.helper.ItemTouchHelper
+import android.util.Log
+import android.view.View
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+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.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.adapter.CallRecordsItemAdapter
+import com.wdkl.ncs.android.component.nursehome.adapter.CallingItemAdapter
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentCallRecordsBinding
+import com.wdkl.ncs.android.component.nursehome.entity.CallingItem
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
+import com.wdkl.ncs.android.component.nursehome.util.LedHelper
+import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
+import com.wdkl.ncs.android.component.nursehome.util.SpeechUtil
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.lib.vo.filter
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.CallRecordsFragmentContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.CallRecordsFragmentPresenter
+import com.wdkl.ncs.android.middleware.model.vo.EventVO
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_call_records.*
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 呼叫记录Fragment
+ */
+class CallRecordsFragment: BaseFragment<CallRecordsFragmentPresenter, FragmentCallRecordsBinding>(), CallRecordsFragmentContract.View,
+    View.OnClickListener, CallingItemAdapter.UpdateCallback {
+
+    var TAG = CallRecordsFragment::class.java.getSimpleName()
+
+    private val adapter = CallRecordsItemAdapter(ArrayList())
+    private var callingAdapter: CallingItemAdapter? = null
+
+    /**
+     * @Name  virtualLayoutManager
+     * @Type  VirtualLayoutManager
+     * @Note  VLayoutManager
+     */
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+
+    private lateinit var delegateAdapter: DelegateAdapter
+
+    private var eventName = ""
+
+    //加载历史记录条数
+    private val pageSize: Int = 15
+    //数据的初始页数
+    private var page: Int = 1
+    //查询历史记录类型
+    private var listType: Int = 1
+
+    override fun getLayId(): Int {
+        return R.layout.fragment_call_records
+    }
+
+
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    override fun init() {
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+        delegateAdapter.addAdapter(adapter)
+        mViewDataBinding.refresh.setRefreshFooter(ClassicsFooter(activity))
+
+        /**配置到RecycleView*/
+        listView.layoutManager = virtualLayoutManager
+        listView.adapter = delegateAdapter
+
+        callingAdapter = CallingItemAdapter(activity, ArrayList())
+        rv_calling_list.layoutManager = VirtualLayoutManager(activity)
+        rv_calling_list.adapter = callingAdapter
+
+        val touchCallback: ItemTouchHelper.Callback =
+            object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) {
+                override fun onMove(
+                    recyclerView: RecyclerView,
+                    viewHolder: RecyclerView.ViewHolder,
+                    target: RecyclerView.ViewHolder
+                ): Boolean {
+                    return false
+                }
+
+                override fun onSwiped(
+                    viewHolder: RecyclerView.ViewHolder,
+                    direction: Int
+                ) {
+                    val pos = viewHolder.adapterPosition
+                    if (callingAdapter != null && pos < callingAdapter!!.itemCount) {
+                        callingAdapter!!.removeCallByPos(pos)
+                    }
+                }
+            }
+        val itemTouchHelper = ItemTouchHelper(touchCallback)
+        itemTouchHelper.attachToRecyclerView(rv_calling_list)
+
+        callingAdapter?.setUpdateCallback(this)
+
+        presenter.loadFloor(page, pageSize, Constants.ids, listType, eventName)
+    }
+
+    /**
+     * 按钮监听
+     */
+    override fun onClick(p0: View) {
+        when(p0.id){
+            //当前呼叫记录
+            R.id.calling_linlyout -> {
+                showCallList()
+            }
+
+            //未接历史记录
+            R.id.no_answer_calls_linlyout -> {
+                ll_call_list.visibility = View.GONE
+                ll_call_record_list.visibility = View.VISIBLE
+                calling_imagev.visibility = View.GONE
+                call_records_imagev.visibility = View.GONE
+                no_answer_calls_imagev.visibility = View.VISIBLE
+                if (listType != 1) {
+                    page = 1
+                    listType = 1
+                    presenter.loadFloor(page, pageSize, Constants.ids, listType, eventName)
+                }
+            }
+
+            //所有历史记录
+            R.id.call_records_linlyout -> {
+                ll_call_list.visibility = View.GONE
+                ll_call_record_list.visibility = View.VISIBLE
+                calling_imagev.visibility = View.GONE
+                no_answer_calls_imagev.visibility = View.GONE
+                call_records_imagev.visibility = View.VISIBLE
+                if (listType != 0) {
+                    page = 1
+                    listType = 0
+                    presenter.loadFloor(page, pageSize, Constants.ids, listType, eventName)
+                }
+            }
+        }
+    }
+
+    fun showCallList() {
+        calling_imagev.visibility = View.VISIBLE
+        call_records_imagev.visibility = View.GONE
+        no_answer_calls_imagev.visibility = View.GONE
+        ll_call_list.visibility = View.VISIBLE
+        ll_call_record_list.visibility = View.GONE
+    }
+
+    override fun onUpdate() {
+        val num = NurseHomeActivity.callingList.size
+        if (num > 9) {
+            calling_num_tv.visibility = View.VISIBLE
+            calling_num_tv.text = "9+"
+            showCallList()
+        } else if (num > 0) {
+            calling_num_tv.visibility = View.VISIBLE
+            calling_num_tv.text = "" + num
+            showCallList()
+        } else {
+            calling_num_tv.visibility = View.GONE
+        }
+    }
+
+    override fun bindEvent() {
+        //点击监听
+        mViewDataBinding.noAnswerCallsLinlyout.setOnClickListener(this)
+        mViewDataBinding.callRecordsLinlyout.setOnClickListener(this)
+        mViewDataBinding.callingLinlyout.setOnClickListener(this)
+
+        configRefresh()
+    }
+
+    override fun destory() {
+    }
+
+    override fun onError(message: String, type: Int) {
+        refresh.finishRefresh()
+        //errorLog("error",message)
+        showMessage(message)
+    }
+
+    override fun start() {
+    }
+
+    override fun renderFloor(data: ArrayList<InteractionVO>) {
+        Log.e(TAG,"CallRecordsFragment走了。。。"+data.size)
+
+        refresh.finishRefresh()
+        if (page == 1) {
+            refresh.resetNoMoreData()
+            adapter.data.clear()
+            if (data.size > 0) {
+                for (item in data) {
+                    if (TcpType.VIDEO.name == item.actionType || TcpType.VOICE.name == item.actionType
+                        || TcpType.ENTRACEGUARD.name == item.actionType || TcpType.SOS.name == item.actionType
+                        || TcpType.REINFORCE.name == item.actionType) {
+                        //if (item.actionDirectionType == 1 || item.actionDirectionType == 2 || item.actionDirectionType == 3) {
+                            adapter.data.add(item)
+                        //}
+                    }
+                }
+                Log.i("abc1"," " + adapter.data.size);
+            }
+            adapter.notifyDataSetChanged()
+            refresh.finishLoadMore()
+        } else {
+            if (data.size > 0) {
+                for (item in data) {
+                    if (TcpType.VIDEO.name == item.actionType || TcpType.VOICE.name == item.actionType
+                        || TcpType.ENTRACEGUARD.name == item.actionType || TcpType.SOS.name == item.actionType
+                        || TcpType.REINFORCE.name == item.actionType) {
+                        //if (item.actionDirectionType == 1 || item.actionDirectionType == 2 || item.actionDirectionType == 3) {
+                            adapter.data.add(item)
+                        //}
+                    }
+                }
+                adapter.notifyDataSetChanged()
+                refresh.finishLoadMore()
+            } else {
+                refresh.finishLoadMoreWithNoMoreData()
+            }
+        }
+
+    }
+
+    override fun showEventdata(data: EventVO) {
+    }
+
+    override fun complete(message: String, type: Int) {
+    }
+
+    private fun configRefresh(){
+        //下拉刷新
+        mViewDataBinding.refresh.setOnRefreshListener {
+            page = 1
+            presenter.loadFloor(page, pageSize, Constants.ids, listType, eventName)
+        }
+        //上拉加载更多
+        mViewDataBinding.refresh.setOnLoadMoreListener {
+            page += 1
+            presenter.loadFloor(page, pageSize, Constants.ids, listType, eventName)
+        }
+    }
+
+    private fun updateRecord() {
+        page = 1
+        presenter.loadFloor(page, pageSize, Constants.ids, listType, eventName)
+    }
+
+    override fun networkMonitor(state: NetState) {
+        state.filter(onWifi = {
+
+        },onMobile = {
+
+        },offline = {
+
+        })
+    }
+
+    private fun checkIfExistCall(interactionVO: InteractionVO): Boolean {
+        if (NurseHomeActivity.callingList.size > 0) {
+            for (item in NurseHomeActivity.callingList) {
+                if (item.interactionVO.id == interactionVO.id) {
+                    return true
+                }
+            }
+        }
+        return false
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        when (messageEvent.getType()) {
+            Constants.EVENT_REFRESH_CALL_LIST -> {
+                Log.d("tcp", "refresh call list")
+                updateRecord()
+            }
+
+            Constants.EVENT_TCP_MSG -> {
+                val tcpModel = messageEvent.getMessage() as TcpModel
+                if (tcpModel.type == TcpType.VOICE) {
+                    val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+                    if (tcpModel.getAction() == TcpAction.VoiceAction.CALL) {
+                        //检查是否重复的呼叫
+                        if (checkIfExistCall(interactionVO)) {
+                            return
+                        }
+
+                        //1.更新点阵屏信息显示
+                        LedHelper.updateLedInfo(interactionVO, true, false)
+
+                        //2.语音播报
+                        if (Constants.CALL_STATE != Constants.CALL_CALLING
+                            && Constants.CALL_STATE != Constants.CALL_OUTGOING
+                            && Constants.CALL_STATE != Constants.CALL_VISIT_CALLING
+                        ) {
+                            if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_ON) {
+                                val frameName = interactionVO.fromFrameFullName.replace("-", "")
+                                SpeechUtil.getInstance().addSpeech(frameName + "呼叫", false)
+                            } else {
+                                RingPlayHelper.playRingTone(activity, R.raw.ring_tone, true)
+                            }
+                        }
+
+                        //3.刷新呼叫列表
+                        updateRecord()
+                        val item = CallingItem(System.currentTimeMillis(), interactionVO)
+                        if (callingAdapter != null) {
+                            callingAdapter?.addCall(item)
+                        }
+                    } else if (tcpModel.getAction() == TcpAction.VoiceAction.CANCEL) {
+                        //对方取消呼叫
+                        LedHelper.updateLedInfo(interactionVO, false, false)
+                        if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_ON) {
+                            val frameName = interactionVO.fromFrameFullName.replace("-", "")
+                            SpeechUtil.getInstance().removeSpeak(frameName + "呼叫")
+                        }
+
+                        if (callingAdapter != null) {
+                            callingAdapter?.removeCall(interactionVO)
+                        }
+                    }
+                }
+            }
+
+            Constants.EVENT_HOOK_OFF -> {
+                //接听呼叫列表中第一个电话
+                if (NurseHomeActivity.callingList.size > 0) {
+                    val itemData = NurseHomeActivity.callingList.get(0).interactionVO
+                    LedHelper.updateLedInfo(itemData, false, false)
+                    EventBus.getDefault().post(MessageEvent(itemData, Constants.EVENT_ACCEPT_CALL))
+                    if (callingAdapter != null) {
+                        callingAdapter?.removeCall(itemData)
+                    }
+                }
+            }
+
+            Constants.EVENT_TRANSFER_CALL -> {
+                val transferData = messageEvent.getMessage() as InteractionVO
+                if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_ON) {
+                    val frameName = transferData.fromFrameFullName.replace("-", "")
+                    SpeechUtil.getInstance().removeSpeak(frameName + "呼叫")
+                }
+                if (callingAdapter != null) {
+                    callingAdapter?.removeCall(transferData)
+                }
+            }
+        }
+    }
+}

+ 181 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/DoctorHostFragment.kt

@@ -0,0 +1,181 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.support.v7.widget.GridLayoutManager
+import android.util.Log
+import android.view.View
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.alibaba.android.vlayout.layout.GridLayoutHelper
+import com.enation.javashop.net.engine.model.NetState
+import com.scwang.smartrefresh.layout.footer.ClassicsFooter
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.DoctorHostAdapter
+import com.wdkl.ncs.android.component.nursehome.adapter.ResponsibilityBedAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentDoctorHostBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.DoctorHostContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.DoctorHostPresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_doctor_host.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 医生主机Fragment
+ */
+class DoctorHostFragment: BaseFragment<DoctorHostPresenter, FragmentDoctorHostBinding>(), DoctorHostContract.View, View.OnClickListener {
+    var TAG = DoctorHostFragment::class.java.getSimpleName()
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+    //医生适配器
+    var doctorHostAdapter: DoctorHostAdapter? = null
+
+    private lateinit var bedVirtualLayoutManager: VirtualLayoutManager
+    private lateinit var bedDelegateAdapter: DelegateAdapter
+    //医生责任床位
+    var responsibilityBedAdapter: ResponsibilityBedAdapter? = null
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_doctor_host
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+
+        doctorHostAdapter = DoctorHostAdapter(ArrayList())
+        delegateAdapter.addAdapter(doctorHostAdapter)
+        mViewDataBinding.doctorHostRefresh.setRefreshFooter(ClassicsFooter(activity))
+
+        /**配置到RecycleView*/
+        doctor_host_recyv.layoutManager = virtualLayoutManager
+        doctor_host_recyv.adapter = delegateAdapter
+
+
+        /**初始化LayoutMannager*/
+        bedVirtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        bedDelegateAdapter = DelegateAdapter(bedVirtualLayoutManager)
+        responsibilityBedAdapter = ResponsibilityBedAdapter(ArrayList())
+        bedDelegateAdapter.addAdapter(responsibilityBedAdapter)
+
+        /**配置到RecycleView*/
+        doctor_duty_sickbed_rev.layoutManager = bedVirtualLayoutManager
+        doctor_duty_sickbed_rev.adapter = bedDelegateAdapter
+
+
+
+        //临时模拟测试数据
+        var doctorHost = ArrayList<String>()
+        doctorHost.add("李医生")
+        doctorHost.add("张医生")
+        doctorHost.add("孔医生")
+        doctorHost.add("孙医生")
+        doctorHost.add("巫医生")
+        doctorHost.add("刘医生")
+        doctorHost.add("猴医生")
+        doctorHost.add("王医生")
+        doctorHost.add("杨医生")
+        doctorHost.add("周医生")
+        doctorHost.add("沈医生")
+
+        doctorHostAdapter!!.data.clear()
+        doctorHostAdapter!!.data.addAll(doctorHost)
+        Log.i(TAG,"医生主机数量 " + doctorHost.size);
+        doctorHostAdapter!!.notifyDataSetChanged()
+
+
+    }
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+        doctorHostAdapter?.setOnItemClickListener { data, position ->
+            //临时模拟测试数据
+            var doctorResponsibilityBed = ArrayList<String>()
+            doctorResponsibilityBed.add("03房01床")
+            doctorResponsibilityBed.add("03房02床")
+            doctorResponsibilityBed.add("03房03床")
+            doctorResponsibilityBed.add("03房04床")
+            doctorResponsibilityBed.add("03房05床")
+            doctorResponsibilityBed.add("03房06床")
+            doctorResponsibilityBed.add("02房02床")
+            doctorResponsibilityBed.add("02房03床")
+            doctorResponsibilityBed.add("02房04床")
+            doctorResponsibilityBed.add("02房05床")
+            doctorResponsibilityBed.add("02房06床")
+            doctorResponsibilityBed.add("02房07床")
+            doctorResponsibilityBed.add("02房08床")
+            doctorResponsibilityBed.add("02房09床")
+
+            responsibilityBedAdapter!!.data.clear()
+            responsibilityBedAdapter!!.data.addAll(doctorResponsibilityBed)
+            Log.i(TAG,"医生责任病床数量 " + doctorResponsibilityBed.size);
+            responsibilityBedAdapter!!.notifyDataSetChanged()
+
+        }
+        call_doctor_bt.setOnClickListener(this)
+
+    }
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+    }
+    /**
+     *显示数据
+     */
+    override fun showData() {
+    }
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    override fun onClick(p0: View?) {
+        showMessage("点击了呼叫医生按钮")
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}

+ 273 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/EntraceGuardVideoFragment.kt.bak

@@ -0,0 +1,273 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.os.Bundle
+import android.os.Handler
+import android.os.Looper
+import android.support.v4.app.Fragment
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.enation.javashop.utils.base.tool.BaseToolActivity
+import com.wdkl.core.voip.VoipEvent
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
+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.DeviceChannel
+import com.wdkl.ncs.android.middleware.tcp.channel.EntraceGuardUtil
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import com.wdkl.skywebrtc.CallSession
+import com.wdkl.skywebrtc.EnumType
+import com.wdkl.skywebrtc.SkyEngineKit
+import com.wdkl.skywebrtc.except.NotInitializedException
+import kotlinx.android.synthetic.main.fragment_entraceguard_video.*
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.webrtc.SurfaceViewRenderer
+
+/**
+ * 门禁机请求开门视频界面fragment
+ */
+class EntraceGuardVideoFragment : Fragment(), CallSession.CallSessionCallback {
+
+    private var layout: View? = null
+    protected lateinit var baseActivity: BaseToolActivity
+
+    protected var gEngineKit: SkyEngineKit? = null
+
+    private var isMute: Boolean = true
+    private var remoteSurfaceView: SurfaceViewRenderer? = null
+
+    private val handler = Handler(Looper.getMainLooper())
+
+    var interactionVO: InteractionVO? = null
+    var tcpModel: TcpModel? = null
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        EventBus.getDefault().register(this)
+    }
+
+    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+        if (layout == null) {
+            layout = inflater.inflate(R.layout.fragment_entraceguard_video, null)
+        }
+
+        /**初始化宿主Activity*/
+        baseActivity = getActivity() as BaseToolActivity
+
+        return layout
+    }
+
+    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+        EntraceGuardUtil.acceptStranger(tcpModel)
+
+        try {
+            SkyEngineKit.init(VoipEvent())
+            gEngineKit = SkyEngineKit.Instance()
+        } catch (e: NotInitializedException) {
+            SkyEngineKit.init(VoipEvent())
+            try {
+                gEngineKit = SkyEngineKit.Instance()
+            } catch (ex: NotInitializedException) {
+                ex.printStackTrace()
+                baseActivity.finish()
+            }
+        }
+
+        init()
+        bindEvent()
+    }
+
+
+    override fun onDestroy() {
+        super.onDestroy()
+        RingPlayHelper.stopRingTone()
+        EventBus.getDefault().unregister(this)
+    }
+
+
+    private fun init() {
+        val session = gEngineKit?.getCurrentSession()
+        if (session != null) {
+            session.setSessionCallback(this)
+        }
+        title.setText(interactionVO!!.fromDeviceName + ",请求开门")
+        RingPlayHelper.playRingTone(activity, R.raw.door_bell, true)
+        speaker_on.isSelected = isMute
+
+    }
+
+    private fun bindEvent() {
+
+        unlock_door.setOnClickListener {
+            var tcpModel = EntraceGuardUtil.unlockDoor(interactionVO)
+            TcpClient.getInstance().sendMsg(tcpModel.toJson())
+            SkyEngineKit.Instance().endCall()
+            Constants.CALL_STATE = Constants.CALL_STANDBY
+            DeviceChannel.calling = false
+            backToMain()
+        }
+
+        sky_voice_call_hangup.setOnClickListener {
+
+            //发送挂断消息
+            TcpClient.getInstance().sendMsg(EntraceGuardUtil.hangup(interactionVO).toJson())
+            //结束sip通话
+            SkyEngineKit.Instance().endCall()
+            Constants.CALL_STATE = Constants.CALL_STANDBY
+            DeviceChannel.calling = false
+            backToMain()
+        }
+
+        speaker_on.setOnClickListener {
+            var session = gEngineKit?.currentSession
+            if (session != null) {
+                isMute = !isMute
+                session.toggleMuteAudio(isMute)
+                session.toggleSpeaker(!isMute)
+                speaker_on.isSelected = isMute
+                TcpClient.getInstance().sendMsg(EntraceGuardUtil.toggleAudio(interactionVO, isMute).toJson())
+            }
+            RingPlayHelper.stopRingTone()
+        }
+
+    }
+
+    private fun backToMain() {
+
+        RingPlayHelper.stopRingTone()
+        EventBus.getDefault().post(MessageEvent("BackCall", Constants.EVENT_REMOVE_CALL_FRAGMENT))
+    }
+
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        when (messageEvent.getType()) {
+            Constants.EVENT_JOIN_HOME_READY -> {
+                Log.i("wdkl", "准备加入房间")
+                val session = SkyEngineKit.Instance().getCurrentSession()
+                if (session != null) {
+                    session.toggleSpeaker(false)
+                    session.toggleMuteAudio(true)
+                    Log.d("WDKL", "session = " + session + "; session.getState() = " + session.state + ",roomId=" + session.roomId)
+                    session.setSessionCallback(this)
+                    session.joinHome(session.roomId)
+                }else{ //会话未成功建立
+                    EntraceGuardUtil.rejectStranger(interactionVO)
+                    backToMain()
+                }
+            }
+            Constants.EVENT_TCP_MSG -> {
+                var tcpModel = messageEvent.getMessage() as TcpModel
+                if (tcpModel.getType() == TcpType.ENTRACEGUARD) { //超时未响应,结束通话退出界面
+                    if(tcpModel.action == TcpAction.EntraceGuardAction.TIMEOUT){
+                        SkyEngineKit.Instance().endCall()
+                        backToMain()
+                    }
+
+                }
+            }
+        }
+    }
+
+
+    //视频来电接通
+    private fun joinVideoCall() {
+        val session = gEngineKit?.getCurrentSession()
+        if (session != null) {
+            Log.e("dds", "video call session state: " + session.state)
+
+//            if (session.state == EnumType.CallState.Incoming) {
+//                val surfaceView = gEngineKit!!.currentSession.setupLocalVideo(false)
+//                if (surfaceView != null) {
+//                    localSurfaceView = surfaceView as SurfaceViewRenderer
+//                    localSurfaceView!!.setZOrderMediaOverlay(false)
+//                    fullscreen_video_frame.addView(localSurfaceView)
+//                }
+//
+//                session.joinHome(session.roomId)
+//                session.toggleSpeaker(true)
+//            } else if (session.state == EnumType.CallState.Idle) {
+//                callEnd()
+//                return
+//            }
+
+//            Handler().postDelayed({
+//                if (session.state == EnumType.CallState.Connected){
+//                    //showCalling(onlyAudio)
+//                } else {
+//                    gEngineKit?.endCall()
+//                    callEnd()
+//                }
+//            }, 2000)
+        }
+    }
+
+    override fun didChangeState(var1: EnumType.CallState?) {
+
+    }
+
+    override fun didDisconnected(userId: String?) {
+
+    }
+
+    override fun didCreateLocalVideoTrack() {
+
+    }
+
+    override fun didError(error: String?) {
+
+    }
+
+    //处理远端视频画面
+    override fun didReceiveRemoteVideoTrack(userId: String?) {
+        Log.e("dds", "didReceiveRemoteVideoTrack  userId: " + userId)
+        handler.post {
+            val session = gEngineKit!!.currentSession
+            if (session != null) {
+//                //本地画面
+//                if (localSurfaceView != null) {
+//                    localSurfaceView!!.setZOrderMediaOverlay(true)
+//                    if (outGoing) {
+//                        if (localSurfaceView!!.parent != null) {
+//                            (localSurfaceView!!.parent as ViewGroup).removeView(localSurfaceView)
+//                        }
+//                        pip_video_frame!!.addView(localSurfaceView)
+//                    }
+//                }
+
+                //远端画面
+                val surfaceView = gEngineKit!!.currentSession.setupRemoteVideo(userId, false)
+                Log.e("dds", "didReceiveRemoteVideoTrack,surfaceView = $surfaceView")
+                if (surfaceView != null) {
+                    remoteSurfaceView = surfaceView as SurfaceViewRenderer
+                    remote_video_surface.removeAllViews()
+//                        if (remoteSurfaceView!!.parent != null) {
+//                            (remoteSurfaceView!!.parent as ViewGroup).removeView(remoteSurfaceView)
+//                        }
+                    remote_video_surface.addView(remoteSurfaceView)
+                }
+            }
+        }
+    }
+
+    override fun didCallEndWithReason(var1: EnumType.CallEndReason?) {
+
+    }
+
+    override fun didChangeMode(isAudioOnly: Boolean) {
+
+    }
+
+    override fun didUserLeave(userId: String?) {
+
+    }
+}

+ 499 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/FramePartFragment.kt

@@ -0,0 +1,499 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.graphics.Color
+import android.hardware.Camera
+import android.support.v7.widget.LinearLayoutManager
+import android.text.method.ScrollingMovementMethod
+import android.util.Log
+import android.view.View
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+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.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.adapter.*
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentFramePartBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
+import com.wdkl.ncs.android.component.nursehome.util.SpeechUtil
+import com.wdkl.ncs.android.component.nursehome.util.TimeTransition
+import com.wdkl.ncs.android.lib.base.BaseFragment
+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.logic.contract.nursehome.FramePartContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.FramePartPresenter
+import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration
+import com.wdkl.ncs.android.middleware.model.dos.DeviceDO
+import com.wdkl.ncs.android.middleware.model.dto.ExaminationConfigByGroupNameDto
+import com.wdkl.ncs.android.middleware.model.dto.FeeConfigByGroupNameDto
+import com.wdkl.ncs.android.middleware.model.vo.*
+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.utils.CommonUtils
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_frame_part.*
+import kotlinx.android.synthetic.main.right_basic_information.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 首页病房病床Fragment
+ */
+class FramePartFragment: BaseFragment<FramePartPresenter, FragmentFramePartBinding>(), FramePartContract.View {
+    var TAG = FramePartFragment::class.java.getSimpleName()
+
+    private var adapter: FrameBedVosConfinementAdapter? = null
+
+    private var feeAdapter: CostItemAdapter? = null
+
+    private var examAdapter: ExamAdapter? = null
+
+    private var hostAdapter: HostDeviceAdapter? = null
+
+    private var clickTime: Long = 0
+    //当前选定的主机所在科室
+    private var selectedPartId: Int = -1
+
+    var frame = FrameBedVO()
+
+    /**
+     * @Name  virtualLayoutManager
+     * @Type  VirtualLayoutManager
+     * @Note  VLayoutManager
+     */
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+
+    /**
+     * @Name  delegateAdapter
+     * @Type  DelegateAdapter
+     * @Note  七巧板适配器
+     */
+    private lateinit var delegateAdapter: DelegateAdapter
+
+
+     var mListener:OnItemListener? = null
+
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:32
+     * @Note   提供layoutID
+     * @return layoutId
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_frame_part
+    }
+
+
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:33
+     * @Note   初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:33
+     * @Note   初始化操作
+     */
+    override fun init() {
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+
+        adapter = FrameBedVosConfinementAdapter(ArrayList())
+        delegateAdapter.addAdapter(adapter)
+        mViewDataBinding.refresh.setRefreshFooter(ClassicsFooter(activity))
+
+        /**配置到RecycleView*/
+        listView.layoutManager = virtualLayoutManager
+        listView.adapter = delegateAdapter
+
+        //滚动显示
+        tv_advice_info.movementMethod = ScrollingMovementMethod.getInstance()
+        tv_illness_info.movementMethod = ScrollingMovementMethod.getInstance()
+
+        //费用
+        feeAdapter = CostItemAdapter(activity, ArrayList())
+        val layoutManager = LinearLayoutManager(this.activity)
+        rv_fee_config.layoutManager = layoutManager
+        rv_fee_config.adapter = feeAdapter
+
+        //检验
+        examAdapter = ExamAdapter(activity, ArrayList())
+        val layoutManager2 = VirtualLayoutManager(this.activity)
+        rv_exam_config.layoutManager = layoutManager2
+        rv_exam_config.adapter = examAdapter
+
+        hostAdapter = HostDeviceAdapter(ArrayList())
+        val layoutManagerHost = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
+        rv_host_list.layoutManager = layoutManagerHost
+        rv_host_list.adapter = hostAdapter
+        hostAdapter!!.setOnClickListener(object : HostDeviceAdapter.OnHostClickListener {
+            override fun onCallClick(device: DeviceDO) {
+                //呼叫其他主机
+                if (System.currentTimeMillis() - clickTime < 3000) {
+                    showMessage("请勿频繁点击")
+                } else {
+                    //呼出时停止语音播报及铃声
+                    SpeechUtil.getInstance().stopSpeak()
+                    RingPlayHelper.stopRingTone()
+
+                    //通话之前先判断webrtc socket是否连接上,否则不能建立通话
+                    if (Constants.tcp_connected) {
+                        VoiceUtil.startAudioCall(Constants.ids, device.id)
+                        Constants.call_type = 0
+                    } else {
+                        showMessage("通话服务未建立连接,请检查网络或稍后再试")
+                    }
+                }
+                clickTime = System.currentTimeMillis()
+            }
+
+            override fun onItemClick(device: DeviceDO) {
+                //加载对应主机科室床位数据
+                selectedPartId = device.partId
+                presenter.loadData(selectedPartId)
+            }
+        })
+
+
+        presenter.loadHostDeviceByManagerDevice(Constants.ids)
+    }
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:33
+     * @Note   绑定事件
+     */
+    override fun bindEvent() {
+        adapter?.setOnItemClickListener { data, position ->
+            frame = data
+            basic_radio.isChecked = true
+
+            if (data.frameBed != null) {
+                if (data.customerName != null) {
+                    name_tv.text = data.customerName
+                    age_tv.text = "" + data.customerAge + data.customerAgeUnit
+                    roomNumber.text = data.frameBed.fullName
+                    if (data.customerSex != null) {
+                        if (data.customerSex == 1) {
+                            head_portrait_imagev.setImageResource(R.drawable.bing_ren_xiang_qing_man)
+                            gender_imagev.setImageResource(R.drawable.man)
+                            gender_imagev.visibility = View.VISIBLE
+                        } else {
+                            head_portrait_imagev.setImageResource(R.drawable.bing_ren_xiang_qing)
+                            gender_imagev.setImageResource(R.drawable.nv)
+                            gender_imagev.visibility = View.VISIBLE
+                        }
+                    } else {
+                        gender_imagev.visibility = View.GONE
+                        head_portrait_imagev.setImageResource(R.drawable.kong_chuang)
+                    }
+                    if (data.frameBed.createTime != null) {
+                        time_tv.text = TimeTransition.stampToDate(data.frameBed.createTime * 1000)
+                    }
+
+                } else {
+                    name_tv.text = "空床位"
+                    age_tv.text = "无"
+                    roomNumber.text = data.frameBed.fullName
+                    gender_imagev.visibility = View.GONE
+                    time_tv.text = "无"
+                    mobile_tv.text = "无"
+                    head_portrait_imagev.setImageResource(R.drawable.kong_chuang)
+                }
+            }
+
+            //默认
+            tv_doctor_name.text = "无"
+            tv_nurse_name.text = "无"
+            tv_nurse_config.text = "无"
+            tv_advice_info.text = "无"
+            tv_illness_info.text = "无"
+            feeAdapter?.updateData(ArrayList())
+            examAdapter?.updateData(ArrayList())
+
+            //加载对应床位人员数据
+            if (data.customerId != null) {
+                presenter.loadCustomerInfo(data.customerId)
+            }
+        }
+
+        call_the_voice_tv.setOnClickListener {
+            //语音呼叫
+            if (System.currentTimeMillis() - clickTime < 3000) {
+                showMessage("请勿频繁点击")
+            } else {
+                if (frame.customerName != null && frame.bedDeviceId != null) {
+                    //呼出时停止语音播报及铃声
+                    SpeechUtil.getInstance().stopSpeak()
+                    RingPlayHelper.stopRingTone()
+                    if (NurseHomeActivity.checkIncomingCall(frame.bedDeviceId)) {
+                        showMessage("该设备已在呼叫列表中,请先处理")
+                    } else {
+                        //通话之前先判断webrtc socket是否连接上,否则不能建立通话
+                        if (Constants.tcp_connected) {
+                            VoiceUtil.startAudioCall(Constants.ids, frame.bedDeviceId)
+                            Constants.call_type = 0
+                        } else {
+                            showMessage("通话服务未建立连接,请检查网络或稍后再试")
+                        }
+                    }
+                } else {
+                    showMessage("床位未入住或未绑定设备,无法通话")
+                }
+            }
+            clickTime = System.currentTimeMillis()
+        }
+
+        if (!Constants.supportCamera) {
+            call_the_video_tv.isEnabled = false
+            call_the_video_tv.setTextColor(Color.parseColor("#e8e8e8"))
+        }
+
+        call_the_video_tv.setOnClickListener {
+            //视频呼叫
+            if (System.currentTimeMillis() - clickTime < 3000) {
+                showMessage("请勿频繁点击")
+            } else {
+                if (frame.customerName != null) {
+                    //呼出时停止语音播报及铃声
+                    SpeechUtil.getInstance().stopSpeak()
+                    RingPlayHelper.stopRingTone()
+                    if (NurseHomeActivity.checkIncomingCall(frame.bedDeviceId)) {
+                        showMessage("该设备已在呼叫列表中,请先处理")
+                    } else {
+                        //通话之前先判断webrtc socket是否连接上,否则不能建立通话
+                        if (Constants.tcp_connected) {
+                            VoiceUtil.startAudioCall(Constants.ids, frame.bedDeviceId)
+                            Constants.call_type = 1
+                        } else {
+                            showMessage("通话服务未建立连接,请检查网络或稍后再试")
+                        }
+                    }
+                } else {
+                    showMessage("床位未入住,无法通话")
+                }
+            }
+            clickTime = System.currentTimeMillis()
+        }
+
+        group_custom_info.setOnCheckedChangeListener { group, checkedId ->
+            if (checkedId == R.id.basic_radio) {
+                rl_basic_info.visibility = View.VISIBLE
+                ll_fee_config.visibility = View.GONE
+                ll_exam_config.visibility = View.GONE
+            } else if (checkedId == R.id.fee_radio) {
+                rl_basic_info.visibility = View.GONE
+                ll_fee_config.visibility = View.VISIBLE
+                ll_exam_config.visibility = View.GONE
+            } else if (checkedId == R.id.exam_radio) {
+                rl_basic_info.visibility = View.GONE
+                ll_fee_config.visibility = View.GONE
+                ll_exam_config.visibility = View.VISIBLE
+            }
+        }
+
+        configRefresh()
+    }
+
+    override fun showCustomerInfo(data: CustomerInfoVO) {
+        //基本信息
+        if (SettingConfiguration.getInstance().doctorValid == 1) {
+            doctor_duty_relalyout.visibility = View.VISIBLE
+            advice_layout.visibility = View.VISIBLE
+            illness_layout.visibility = View.VISIBLE
+        } else {
+            doctor_duty_relalyout.visibility = View.GONE
+            advice_layout.visibility = View.GONE
+            illness_layout.visibility = View.GONE
+        }
+        if (SettingConfiguration.getInstance().nurseValid == 1) {
+            nurse_duty_relalyout.visibility = View.VISIBLE
+        } else {
+            nurse_duty_relalyout.visibility = View.GONE
+        }
+        tv_doctor_title.text = SettingConfiguration.getInstance().doctorTitle
+        tv_nurse_title.text = SettingConfiguration.getInstance().nurseTitle
+
+        tv_doctor_name.text = data.doctorName
+        tv_nurse_name.text = data.nurseName
+        var nurseConfigs = ""
+        if (data.list != null) {
+            for (e in data.list) {
+                nurseConfigs = nurseConfigs + e.nurseOptionAndConfigName + "\n"
+            }
+        }
+        tv_nurse_config.text = nurseConfigs
+        tv_advice_info.text = data.advice
+        tv_illness_info.text = data.illnessDesc
+
+        //费用信息
+        if (data.feeConfigByGroupNameList != null) {
+            var feeList = ArrayList<FeeConfigByGroupNameDto>()
+            feeList.addAll(data.feeConfigByGroupNameList)
+            feeAdapter?.updateData(feeList)
+        }
+
+        //检验信息
+        if (data.examinationConfigByGroupNameList != null) {
+            var examList = ArrayList<ExaminationConfigByGroupNameDto>()
+            examList.addAll(data.examinationConfigByGroupNameList)
+            examAdapter?.updateData(examList)
+        }
+    }
+
+    //获取其他护士主机
+    override fun showOtherHostDevice(devices: ArrayList<DeviceDO>) {
+        //
+    }
+
+    //获取总控下面的主机
+    override fun showHostDevice(devices: ArrayList<DeviceDO>) {
+        if (devices.size > 0) {
+            //显示科室主机,默认选中第一个
+            hostAdapter?.setSelectHost(0)
+            hostAdapter?.updateData(devices)
+            //显示主机对应科室床位数据
+            selectedPartId = devices[0].partId
+            presenter.loadData(selectedPartId)
+        }
+    }
+
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:34
+     * @Note   页面销毁回调
+     */
+    override fun destory() {
+        debugLog("HomeFragment","Destory")
+    }
+
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:35
+     * @Note   处理错误信息
+     * @param  message  错误信息
+     */
+    override fun onError(message: String, type: Int) {
+        refresh.finishRefresh()
+        //errorLog("error",message)
+        showMessage(message)
+    }
+
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:37
+     * @Note   耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/8/16 下午4:08
+     * @Note   渲染楼层
+     * @param  data  数据
+     */
+    override fun showData(data: FramePartVO) {
+        if (data.frameRoomVos != null){
+            var frameRoomVos = data.frameRoomVos as ArrayList<FrameRoomVO>
+            var frameBedVO = ArrayList<FrameBedVO>()
+
+            for (frameRoomVo in frameRoomVos) {
+                var frameBedVOs = frameRoomVo.frameBedList
+                if (frameBedVOs != null && frameBedVOs.size > 0) {
+                    frameBedVO.addAll(frameBedVOs)
+                }
+            }
+            CommonUtils.setInBedVos(frameBedVO)
+
+            adapter!!.data.clear()
+            adapter!!.data.addAll(frameBedVO)
+            Log.i("abc2", " " + frameRoomVos.size);
+            adapter!!.notifyDataSetChanged()
+        }
+        refresh.finishRefresh()
+        refresh.finishLoadMore()
+    }
+
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:36
+     * @Note   操作完成
+     * @param  message 完成信息
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:37
+     * @Note   配置刷新监听处理
+     */
+    private fun configRefresh(){
+        refresh.setOnRefreshListener {
+            if (selectedPartId != -1) {
+                presenter.loadData(selectedPartId)
+            } else {
+                refresh.finishRefresh()
+            }
+        }
+    }
+    /**
+     * @author LDD
+     * @From   HomeFragment
+     * @Date   2018/1/19 下午5:39
+     * @Note   处理网络状态
+     * @param  state 网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+        state.filter(onWifi = {
+
+        },onMobile = {
+
+        },offline = {
+
+        })
+    }
+    fun setOnItemListener(mListener: OnItemListener) {
+        this.mListener = mListener
+    }
+
+    interface OnItemListener {
+        fun theBedInformation(data: FrameBedVO)
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        when (messageEvent.getType()) {
+            Constants.EVENT_TCP_MSG -> {
+                val tcpModel = messageEvent.getMessage() as TcpModel
+                if (tcpModel.action == TcpAction.DataAction.REFRESH) {
+                    //更新数据
+                    if (selectedPartId != -1) {
+                        presenter.loadData(selectedPartId)
+                    }
+                }
+            }
+        }
+    }
+}

+ 142 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/InpatientWardFragment.kt

@@ -0,0 +1,142 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.util.Log
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.InpatientWardAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentInpatientWardBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.InpatientWardContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.InpatientWardPresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_inpatient_ward.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 病区列表Fragment
+ */
+class InpatientWardFragment : BaseFragment<InpatientWardPresenter, FragmentInpatientWardBinding>(), InpatientWardContract.View {
+    var TAG = InpatientWardFragment::class.java.getSimpleName()
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+    private val inpatientWardAdapter = InpatientWardAdapter(ArrayList())
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_inpatient_ward
+    }
+
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    /**
+     *初始化操作
+     */
+    override fun init() {
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+        delegateAdapter.addAdapter(inpatientWardAdapter)
+
+        /**配置到RecycleView*/
+        inpatient_ward_recview.layoutManager = virtualLayoutManager
+        inpatient_ward_recview.adapter = delegateAdapter
+
+
+        var data = ArrayList<String>()
+        data.add("测试1")
+        data.add("测试2")
+        data.add("测试3")
+        data.add("测试4")
+        data.add("测试5")
+        data.add("测试6")
+        data.add("测试7")
+        data.add("测试8")
+
+
+        //临时模拟数据
+        if (data.size > 0) {
+            inpatientWardAdapter.data.clear()
+            inpatientWardAdapter.data.addAll(data)
+            Log.i(TAG, " " + data.size)
+            inpatientWardAdapter.notifyDataSetChanged()
+        }
+
+
+    }
+
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+        inpatientWardAdapter.setOnItemClickListener { data, position ->
+            BedsInTheWardFragment().updateData(data)
+
+        }
+    }
+
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+
+    }
+
+    /**
+     *显示数据
+     */
+    override fun showData() {
+
+    }
+
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+
+    }
+
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}
+

+ 207 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/LedSettingsFragment.kt

@@ -0,0 +1,207 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.os.Bundle
+import android.support.v4.app.Fragment
+import android.support.v7.widget.LinearLayoutManager
+import android.text.TextUtils
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.SeekBar
+import com.enation.javashop.utils.base.tool.BaseToolActivity
+import com.scwang.smartrefresh.layout.footer.ClassicsFooter
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.adapter.LedItemAdapter
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+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.lib.utils.showMessage
+import kotlinx.android.synthetic.main.fragment_led_settings.*
+
+class LedSettingsFragment: Fragment() {
+
+    protected lateinit var baseActivity: BaseToolActivity
+
+    private var adapter: LedItemAdapter? = null
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        retainInstance = true
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View {
+
+        /**初始化宿主Activity*/
+        baseActivity = getActivity() as BaseToolActivity
+
+        return inflater.inflate(R.layout.fragment_led_settings, null)
+    }
+
+    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+
+        adapter = LedItemAdapter(LedManagerUtils.getInstance().ledList)
+        val layoutManager = LinearLayoutManager(baseActivity)
+        recycler_led_list.layoutManager = layoutManager
+        recycler_led_list.adapter = adapter
+
+        if (LedManagerUtils.getInstance().ledList.size == 0) {
+            tv_led_empty_titile.visibility = View.VISIBLE
+        } else {
+            tv_led_empty_titile.visibility = View.GONE
+        }
+
+        adapter?.setOnItemClickListener(object : LedItemAdapter.OnClickListener{
+            override fun onClick(item: LedItem) {
+                tv_led_type.setText("点阵屏规格: " + item.resolution)
+                if (item.voiceOn) {
+                    tv_led_voice_on.setText("语音播报: 开启")
+                } else {
+                    tv_led_voice_on.setText("语音播报: 关闭")
+                }
+                tv_led_font_size.setText("字体大小: " + item.fontSize)
+            }
+        })
+
+        init()
+        bindEvent()
+    }
+
+    private fun init() {
+        val ledProgramTime = SettingConfig.getLedProgramTime(baseActivity)
+        val ledVoiceVolume = SettingConfig.getLedVoiceVolume(baseActivity)
+        val ledVoiceTimes = SettingConfig.getLedVoiceTimes(baseActivity)
+        val ledInfoType = SettingConfig.getLedInfoType(baseActivity)
+        val info = SettingConfig.getLedCustomInfo(baseActivity)
+
+        tv_led_program_time.setText("点阵屏呼叫信息显示时长: " + ledProgramTime)
+        skb_led_program_time.progress = ledProgramTime
+
+        tv_led_volume.setText("点阵屏语音呼叫音量:" + ledVoiceVolume)
+        skb_led_volume.progress = ledVoiceVolume
+
+        tv_led_voice_times.setText("点阵屏语音呼叫次数:" + ledVoiceTimes)
+        skb_led_voice_times.progress = ledVoiceTimes
+
+        //led_refresh.setRefreshFooter(ClassicsFooter(activity))
+
+        if (ledInfoType == 1) {
+            rb_custom_info.isChecked = true
+            led_custom_content.visibility = View.VISIBLE
+            led_custom_content.setText(info)
+        } else {
+            rb_date_time.isChecked = true
+            led_custom_content.visibility = View.INVISIBLE
+        }
+    }
+
+    private fun bindEvent() {
+        btn_sync_time.setOnClickListener {
+            LedManagerUtils.getInstance().syncTime()
+        }
+
+        btn_reset_led.setOnClickListener {
+            LedManagerUtils.getInstance().removeAllProgram()
+        }
+
+        btn_check_font.setOnClickListener {
+            LedManagerUtils.getInstance().checkFontFile()
+        }
+
+        btn_power_on_off.setOnClickListener {
+            LedManagerUtils.getInstance().powerOnOff()
+        }
+
+        btn_update_font.setOnClickListener {
+            LedManagerUtils.getInstance().copyFont()
+        }
+
+        /*led_refresh.setOnRefreshListener {
+            (activity as NurseHomeActivity).loadLedDevice()
+        }*/
+
+        skb_led_program_time.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
+                tv_led_program_time.setText("点阵屏呼叫信息显示时长: " + progress)
+            }
+
+            override fun onStartTrackingTouch(seekBar: SeekBar?) {
+                //
+            }
+
+            override fun onStopTrackingTouch(seekBar: SeekBar?) {
+                if (seekBar!!.progress < 5) {
+                    showMessage("最小值不能小于5")
+                    seekBar.progress = 5
+                }
+                SettingConfig.setLedProgramTime(baseActivity, seekBar.progress)
+            }
+        })
+
+        skb_led_volume.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
+                tv_led_volume.setText("点阵屏语音呼叫音量:" + progress)
+            }
+
+            override fun onStartTrackingTouch(seekBar: SeekBar?) {
+                //
+            }
+
+            override fun onStopTrackingTouch(seekBar: SeekBar?) {
+                if (seekBar!!.progress <= 0) {
+                    showMessage("最小值不能小于1")
+                    seekBar.progress = 1
+                }
+                SettingConfig.setLedVoiceVolume(baseActivity, seekBar.progress)
+            }
+        })
+
+        skb_led_voice_times.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
+                tv_led_voice_times.setText("点阵屏语音呼叫次数:" + progress)
+            }
+
+            override fun onStartTrackingTouch(seekBar: SeekBar?) {
+                //
+            }
+
+            override fun onStopTrackingTouch(seekBar: SeekBar?) {
+                if (seekBar!!.progress <= 0) {
+                    showMessage("最小值不能小于1")
+                    seekBar.progress = 1
+                }
+                SettingConfig.setLedVoiceTimes(baseActivity, seekBar.progress)
+            }
+        })
+
+        val info = SettingConfig.getLedCustomInfo(baseActivity)
+        group_led_info_type.setOnCheckedChangeListener { group, checkedId ->
+            if (checkedId == R.id.rb_date_time) {
+                led_custom_content.visibility = View.INVISIBLE
+            } else {
+                led_custom_content.setText(info)
+                led_custom_content.visibility = View.VISIBLE
+            }
+        }
+    }
+
+    override fun onDestroyView() {
+        super.onDestroyView()
+
+        if (group_led_info_type.checkedRadioButtonId == R.id.rb_date_time) {
+            SettingConfig.setLedInfoType(baseActivity, 0)
+            SettingConfig.setLedCustomInfo(baseActivity, "")
+        } else {
+            val info = led_custom_content.text.toString()
+            SettingConfig.setLedInfoType(baseActivity, 1)
+            SettingConfig.setLedCustomInfo(baseActivity, info)
+        }
+    }
+
+}

+ 182 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/NurseMoveFragment.kt

@@ -0,0 +1,182 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.util.Log
+import android.view.View
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.scwang.smartrefresh.layout.footer.ClassicsFooter
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.DoctorHostAdapter
+import com.wdkl.ncs.android.component.nursehome.adapter.NurseMoveAdapter
+import com.wdkl.ncs.android.component.nursehome.adapter.ResponsibilityBedAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentNurseMoveBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.NurseMoveContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.NurseMovePresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_doctor_host.*
+import kotlinx.android.synthetic.main.fragment_nurse_move.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+class NurseMoveFragment : BaseFragment<NurseMovePresenter,FragmentNurseMoveBinding>(), NurseMoveContract.View, View.OnClickListener {
+    var TAG = NurseMoveFragment::class.java.getSimpleName()
+
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+    //护士适配器
+    var nurseMoveAdapter: NurseMoveAdapter? = null
+
+    private lateinit var bedVirtualLayoutManager: VirtualLayoutManager
+    private lateinit var bedDelegateAdapter: DelegateAdapter
+    //护士责任床位适配器
+    var responsibilityBedAdapter: ResponsibilityBedAdapter? = null
+
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+    return R.layout.fragment_nurse_move
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+
+        nurseMoveAdapter = NurseMoveAdapter(ArrayList())
+        delegateAdapter.addAdapter(nurseMoveAdapter)
+        mViewDataBinding.nurseMoveRefresh.setRefreshFooter(ClassicsFooter(activity))
+
+        /**配置到RecycleView*/
+        nurse_move_recyv.layoutManager = virtualLayoutManager
+        nurse_move_recyv.adapter = delegateAdapter
+
+        /**初始化LayoutMannager*/
+        bedVirtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        bedDelegateAdapter = DelegateAdapter(bedVirtualLayoutManager)
+        responsibilityBedAdapter = ResponsibilityBedAdapter(ArrayList())
+        bedDelegateAdapter.addAdapter(responsibilityBedAdapter)
+
+        /**配置到RecycleView*/
+        nurse_duty_sickbed_rev.layoutManager = bedVirtualLayoutManager
+        nurse_duty_sickbed_rev.adapter = bedDelegateAdapter
+
+
+
+
+        //临时模拟测试数据
+        var nurseList = ArrayList<String>()
+        nurseList.add("李护士")
+        nurseList.add("张护士")
+        nurseList.add("孔护士")
+        nurseList.add("孙护士")
+        nurseList.add("巫护士")
+        nurseList.add("刘护士")
+        nurseList.add("猴护士")
+        nurseList.add("王护士")
+        nurseList.add("杨护士")
+        nurseList.add("周护士")
+        nurseList.add("沈护士")
+
+        nurseMoveAdapter!!.data.clear()
+        nurseMoveAdapter!!.data.addAll(nurseList)
+        Log.i(TAG,"护士主机数量 " + nurseList.size)
+        nurseMoveAdapter!!.notifyDataSetChanged()
+        
+        
+        
+    }
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+        nurseMoveAdapter?.setOnItemClickListener { data, position ->
+            //临时模拟测试数据
+            var nurseResponsibilityBed = ArrayList<String>()
+            nurseResponsibilityBed.add("03房01床")
+            nurseResponsibilityBed.add("03房02床")
+            nurseResponsibilityBed.add("03房03床")
+            nurseResponsibilityBed.add("03房04床")
+            nurseResponsibilityBed.add("03房05床")
+            nurseResponsibilityBed.add("03房06床")
+            nurseResponsibilityBed.add("02房02床")
+            nurseResponsibilityBed.add("02房03床")
+            nurseResponsibilityBed.add("02房04床")
+            nurseResponsibilityBed.add("02房05床")
+            nurseResponsibilityBed.add("02房06床")
+            nurseResponsibilityBed.add("02房07床")
+            nurseResponsibilityBed.add("02房08床")
+            nurseResponsibilityBed.add("02房09床")
+
+            responsibilityBedAdapter!!.data.clear()
+            responsibilityBedAdapter!!.data.addAll(nurseResponsibilityBed)
+            Log.i(TAG,"医生责任病床数量 " + nurseResponsibilityBed.size);
+            responsibilityBedAdapter!!.notifyDataSetChanged()
+
+        }
+        call_nurse_bt.setOnClickListener(this)
+        
+        
+    }
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+    }
+    /**
+     *显示数据
+     */
+    override fun showData() {
+    }
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    override fun onClick(p0: View?) {
+        showMessage("点击了呼叫护士按钮")
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}

+ 139 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/OtherHostFragment.kt

@@ -0,0 +1,139 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.util.Log
+import android.view.View
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.scwang.smartrefresh.layout.footer.ClassicsFooter
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.NurseMoveAdapter
+import com.wdkl.ncs.android.component.nursehome.adapter.OtherHostAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentOtherHostBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.OtherHostContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.OtherHostPresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_nurse_move.*
+import kotlinx.android.synthetic.main.fragment_other_host.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 其它主机Fragment
+ */
+class OtherHostFragment : BaseFragment<OtherHostPresenter,FragmentOtherHostBinding>(), OtherHostContract.View, View.OnClickListener {
+    var TAG = OtherHostFragment::class.java.getSimpleName()
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+    //护士适配器
+    var otherHostAdapter: OtherHostAdapter? = null
+    
+    
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_other_host
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+
+        otherHostAdapter = OtherHostAdapter(ArrayList())
+        delegateAdapter.addAdapter(otherHostAdapter)
+        mViewDataBinding.otherHostRefresh.setRefreshFooter(ClassicsFooter(activity))
+
+        /**配置到RecycleView*/
+        other_host_recyv.layoutManager = virtualLayoutManager
+        other_host_recyv.adapter = delegateAdapter
+
+
+        //临时模拟测试数据
+        var other_hostList = ArrayList<String>()
+        other_hostList.add("主机1")
+        other_hostList.add("主机2")
+        other_hostList.add("主机3")
+        other_hostList.add("主机4")
+        other_hostList.add("主机5")
+        other_hostList.add("主机6")
+        other_hostList.add("主机7")
+        other_hostList.add("主机8")
+        other_hostList.add("主机9")
+        other_hostList.add("主机10")
+        other_hostList.add("主机11")
+
+        otherHostAdapter!!.data.clear()
+        otherHostAdapter!!.data.addAll(other_hostList)
+        Log.i(TAG,"其它主机数量 " + other_hostList.size)
+        otherHostAdapter!!.notifyDataSetChanged()
+    }
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+        call_other_host_bt.setOnClickListener(this)
+        
+    }
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+    }
+    /**
+     *显示数据
+     */
+    override fun showData() {
+    }
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    override fun onClick(p0: View?) {
+        showMessage("点击了呼叫其它主机按钮")
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}

+ 111 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SickbedFragment.kt

@@ -0,0 +1,111 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.scwang.smartrefresh.layout.footer.ClassicsFooter
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.FrameBedVosAdapter
+import com.wdkl.ncs.android.component.nursehome.adapter.FramePartItemAdapter
+import com.wdkl.ncs.android.component.nursehome.adapter.SickbedAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentSickbedBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.SickbedContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.SickbedPresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_frame_part.*
+import kotlinx.android.synthetic.main.fragment_sickbed.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 病床Fragment
+ */
+class SickbedFragment:BaseFragment<SickbedPresenter,FragmentSickbedBinding>(),SickbedContract.View {
+    var TAG = SickbedFragment::class.java.getSimpleName()
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+   var sickbedAdapter : SickbedAdapter? = null
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_sickbed
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+//        /**初始化LayoutMannager*/
+//        virtualLayoutManager = VirtualLayoutManager(this.activity)
+//
+//        /**初始化适配器*/
+//        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+//
+//        sickbedAdapter = SickbedAdapter(this.activity,mListener,ArrayList())
+//        delegateAdapter.addAdapter(sickbedAdapter)
+//        mViewDataBinding.sickbed_refresh.setRefreshFooter(ClassicsFooter(activity))
+//
+//        /**配置到RecycleView*/
+//        sickbed_recyv.layoutManager = virtualLayoutManager
+//        sickbed_recyv.adapter = delegateAdapter
+
+
+    }
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+    }
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+    }
+    /**
+     *显示数据
+     */
+    override fun showData() {
+    }
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//  var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+ }
+
+}

+ 417 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SkyCallFragment.kt

@@ -0,0 +1,417 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.os.CountDownTimer
+import android.os.Handler
+import android.os.Looper
+import android.os.SystemClock
+import android.util.Log
+import android.view.View
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.google.gson.Gson
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.BedItemAdapter
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.util.RingPlayHelper
+import com.wdkl.ncs.android.lib.base.BaseApplication
+import com.wdkl.ncs.android.lib.utils.AppTool
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.tcp.channel.DeviceChannel
+import com.wdkl.ncs.android.middleware.tcp.channel.VideoUtil
+import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.tcp.enums.DeviceTypeEnum
+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.CommonUtils
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import com.wdkl.ncs.janus.client.CallSessionCallback
+import com.wdkl.ncs.janus.client.JanusClient
+import com.wdkl.ncs.janus.client.VideoRoomCallback
+import com.wdkl.ncs.janus.entity.Room
+import com.wdkl.ncs.janus.rtc.WebRTCEngine
+import com.wdkl.ncs.janus.util.JanusConstant
+import com.wdkl.ncs.janus.util.EnumType
+import kotlinx.android.synthetic.main.sky_voice_call_layout.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.webrtc.SurfaceViewRenderer
+import java.math.BigInteger
+
+class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
+    private val TAG = "SkyCallFragment"
+
+    private var localSurfaceView: SurfaceViewRenderer? = null
+    private var remoteSurfaceView: SurfaceViewRenderer? = null
+
+    private var bedItemAdapter: BedItemAdapter? = null
+
+    private val handler = Handler(Looper.getMainLooper())
+
+    private var callEnded: Boolean = false
+
+    private var outGoing: Boolean = false
+
+    private var janusClient: JanusClient? = null
+    private var room: Room?=null
+    private var videoRoomCallback: VideoRoomCallback? = null
+
+    //呼叫倒计时
+    lateinit var countDownTimer: CountDownTimer
+
+    override fun getLayId(): Int {
+        return R.layout.sky_voice_call_layout
+    }
+
+    override fun init() {
+        initCountDownTimer()
+        //初始化 engine
+        WebRTCEngine.getInstance().init(true, BaseApplication.appContext)
+        //初始化 janusClient
+        janusClient = JanusClient(JanusConstant.JANUS_URL, Constants.sip_id!!.toBigInteger())
+
+        if (visiting) {
+            bedItemAdapter = BedItemAdapter(baseActivity, CommonUtils.getInBedVOS())
+            visit_list_view.setAdapter(bedItemAdapter)
+            visit_list_view.setLayoutManager(VirtualLayoutManager(baseActivity))
+            visit_list_view.setVisibility(View.GONE)
+            fullscreen_video_frame.setOnClickListener(View.OnClickListener {
+                if (visit_list_view.getVisibility() == View.GONE) {
+                    visit_list_view.setVisibility(View.VISIBLE)
+                } else {
+                    visit_list_view.setVisibility(View.GONE)
+                }
+            })
+
+            bindListener()
+        }
+
+        Log.d(TAG, "out call callState: $callState, local sip: $Constants.sip_id, target sip: ${Constants.targetSipId}")
+        when (callState) {
+            0 -> {
+                //发起通话
+                outGoing = true
+                janusClient!!.callState = EnumType.CallState.Outgoing
+                room = Room(Constants.sip_id!!.toBigInteger())
+                showCallView(true)
+                Constants.CALL_STATE = Constants.CALL_OUTGOING
+                DeviceChannel.calling = true
+                RingPlayHelper.playRingTone(BaseApplication.appContext, R.raw.ring_back2, true)
+            }
+
+            1 -> {
+                //如果是模拟分机呼叫则需要主机来创建房间发起通过
+                if (Constants.fromDeviceType == DeviceTypeEnum.SIMULATE_BED_DEVICE.value()) {
+                    outGoing = true
+                    janusClient!!.callState = EnumType.CallState.Outgoing
+                    room = Room(Constants.sip_id!!.toBigInteger())
+                    showCallView(false)
+                    Constants.CALL_STATE = Constants.CALL_CALLING
+                    DeviceChannel.calling = true
+                } else {
+                    //接受通话
+                    outGoing = false
+                    janusClient!!.callState = EnumType.CallState.Incoming
+                    room = Room(Constants.targetSipId!!.toBigInteger())
+                    showCallView(false)
+                    Constants.CALL_STATE = Constants.CALL_CALLING
+                    DeviceChannel.calling = true
+                }
+            }
+        }
+
+        videoRoomCallback = VideoRoomCallback(janusClient, room, Constants.sip_id!!.toBigInteger())
+        videoRoomCallback!!.callSessionCallback = this
+        janusClient!!.setJanusCallback(videoRoomCallback)
+        janusClient!!.connect()
+    }
+
+    private fun initCountDownTimer() {
+        if (SettingConfiguration.getInstance().sipOvertime <= 0) {
+            SettingConfiguration.getInstance().sipOvertime = 30
+        }
+
+        countDownTimer = object: CountDownTimer(SettingConfiguration.getInstance().sipOvertime*1000L, 1000) {
+            override fun onTick(millisUntilFinished: Long) {
+                //
+            }
+
+            override fun onFinish() {
+                //呼叫超时,退出呼叫界面
+                showMessage("无人接听...")
+                DeviceChannel.calling = false
+                Constants.CALL_STATE = Constants.CALL_STANDBY
+                VoiceUtil.cancelAudioCall(Constants.ids, Constants.targetDeviceId)
+                callEnd(false)
+            }
+        }
+    }
+
+    private fun bindListener() {
+        bedItemAdapter!!.setInvitClickListener { bedVO ->
+            Constants.visitedId = bedVO.bedDeviceId
+            visit_list_view.setVisibility(View.GONE)
+            Constants.visit_bed_name = bedVO.frameBed.fullName
+
+            //延迟发送
+            Handler().postDelayed({ //发送探视邀请给分机
+                VideoUtil.sendInviteVideoCall(Constants.ids,
+                    bedVO.bedDeviceId,
+                    Constants.interactionId)
+            }, 2000)
+
+            //关闭主机和探视机的视频,然后由分机向探视机发视频通话
+            /*if (gEngineKit!!.currentSession != null) {
+                Log.d("dds", "endCall")
+                SkyEngineKit.Instance().endCall()
+            }*/
+
+            //backToMain()
+        }
+    }
+
+    override fun bindEvent() {
+        //通话挂断
+        sky_voice_call_hangup.setOnClickListener {
+            if (Constants.CALL_STATE == Constants.CALL_CALLING) {
+                callEnd(true)
+            } else {
+                countDownTimer.cancel()
+                VoiceUtil.cancelAudioCall(Constants.ids, Constants.targetDeviceId)
+                callEnd(false)
+            }
+
+            Constants.CALL_STATE = Constants.CALL_STANDBY
+            DeviceChannel.calling = false
+        }
+    }
+
+    override fun destroy() {
+        //RingPlayHelper.stopRingTone()
+        Constants.CALL_STATE = Constants.CALL_STANDBY
+        DeviceChannel.calling = false
+        if (sky_voice_call_timer != null) {
+            sky_voice_call_timer.stop()
+        }
+        handler.removeCallbacksAndMessages(null)
+    }
+
+    //开始接听
+    private fun showCallView(outgoing: Boolean) {
+        sky_call_name.text = callName
+        if (outgoing) {
+            countDownTimer.start()
+            sky_voice_call_calling_text.text = "正在呼叫..."
+        } else {
+            sky_voice_call_calling_text.text = "连接中..."
+        }
+        sky_voice_call_outgoing.visibility = View.VISIBLE
+        sky_voice_call_timer.visibility = View.GONE
+    }
+
+    private fun showCalling(audioOnly: Boolean) {
+        if (callEnded) {
+            return
+        }
+
+        if (audioOnly) {
+            //移除视频画面
+            fullscreen_video_frame.visibility = View.GONE
+            pip_video_frame.visibility = View.GONE
+            ll_voice_call.visibility = View.VISIBLE
+        } else {
+            //显示视频画面
+            fullscreen_video_frame.visibility = View.VISIBLE
+            pip_video_frame.visibility = View.VISIBLE
+            ll_voice_call.visibility = View.GONE
+
+            if (visiting) {
+                visit_list_view.setVisibility(View.VISIBLE)
+            }
+        }
+
+        sky_voice_call_calling_text.text = "通话中..."
+        sky_voice_call_timer.visibility = View.VISIBLE
+        sky_voice_call_timer.base = SystemClock.elapsedRealtime()
+        sky_voice_call_timer.start()
+    }
+
+    //通话结束
+    private fun callEnd(handoff: Boolean) {
+        Log.e(TAG, "call end !!!!!!!!!!!!!!!!!!")
+        RingPlayHelper.stopRingTone()
+        countDownTimer.cancel()
+
+        synchronized(this) {
+            if (callEnded) {
+                return
+            }
+            callEnded = true
+
+            if (sky_voice_call_timer != null) {
+                sky_voice_call_timer.stop()
+            }
+
+            if (janusClient != null && janusClient!!.webSocketChannel !=null) {
+                janusClient!!.callState = EnumType.CallState.Idle
+                if (outGoing){
+                    if (janusClient!!.currentHandleId !=null) {
+                        janusClient!!.destroyRoom(janusClient!!.currentHandleId, null)
+                    }
+                } else {
+                    janusClient!!.leaveRoom()
+                }
+
+                janusClient!!.setJanusCallback(null)
+                janusClient!!.disConnect()
+            }
+
+            Constants.CALL_STATE = Constants.CALL_STANDBY
+            DeviceChannel.calling = false
+            if (handoff) {
+                VoiceUtil.handoffAudioCall(Constants.ids, Constants.fromId, Constants.interactionId)
+            }
+
+            backToMain()
+        }
+    }
+
+
+    /********************************************************
+     ********************* webrtc通话回调 ********************
+     * 注意: 如涉及到UI更新的需要在主线程处理,务必注意
+     *******************************************************/
+    //************************* 通话回调 *******************//
+    override fun didChangeState(var1: EnumType.CallState?) {
+        handler.post {
+            if (var1 == EnumType.CallState.Connected) {
+                Log.e(TAG, "didChangeState: " + var1)
+                if (var1 == EnumType.CallState.Connected && !callEnded) {
+                    RingPlayHelper.stopRingTone()
+                    Constants.CALL_STATE = Constants.CALL_CALLING
+                    DeviceChannel.calling = true
+                    //更新界面显示
+                    showCalling(onlyAudio)
+                }
+
+                if (Constants.hookOn) {
+                    WebRTCEngine.getInstance().toggleSpeaker(true)
+                } else {
+                    //手柄拿起,听筒模式
+                    WebRTCEngine.getInstance().toggleSpeaker(false)
+                }
+            }
+        }
+    }
+
+    override fun didDisconnected(userId: String?) {
+        Log.w(TAG, "didDisconnected")
+        handler.post {
+            if (userId.equals(Constants.targetSipId)) {
+                showMessage("断开连接")
+                callEnd(true)
+            }
+        }
+    }
+
+    override fun didCreateLocalVideoTrack() {
+    }
+
+    override fun didError(error: String?) {
+        Log.e(TAG, "didError: " + error)
+        handler.post {
+            showMessage("通话错误")
+            callEnd(true)
+        }
+    }
+
+    override fun didHangUp(handlerId: BigInteger) {
+        Log.e("hangup", "socket hangup")
+        handler.post {
+            callEnd(true)
+        }
+    }
+
+    override fun didReceiveRemoteVideoTrack(userId: BigInteger?) {
+        // TODO("Not yet implemented")
+    }
+
+
+    override fun didCallEndWithReason(var1: EnumType.CallEndReason?) {
+        //
+    }
+
+    override fun didUserLeave(userId: BigInteger?) {
+        Log.w(TAG, "didUserLeave")
+        handler.post {
+            callEnd(true)
+        }
+    }
+
+    override fun didChangeMode(isAudioOnly: Boolean) {
+        Log.w(TAG,"didChangeMode")
+    }
+
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        when (messageEvent.getType()) {
+            Constants.EVENT_TCP_MSG -> {
+                if (messageEvent.getMessage() is TcpModel) {
+                    val curTcpModel = messageEvent.getMessage() as TcpModel
+                    if (curTcpModel.getType() == TcpType.VOICE) {
+                        val curInteractionVO = Gson().fromJson(curTcpModel.data.toString(), InteractionVO::class.java)
+                        if (curTcpModel.getAction() == TcpAction.VoiceAction.HANDOFF) {
+                            //对方挂断,不论我方呼出或呼入
+                            if (Constants.interactionId == curInteractionVO.id) {
+                                callEnd(false)
+                            }
+                        } else if (curTcpModel.getAction() == TcpAction.VoiceAction.ACCEPT) {//对方接受语音
+                            RingPlayHelper.stopRingTone()
+                            sky_voice_call_calling_text.text = "连接中..."
+                            Constants.interactionId = curInteractionVO.id
+                            Constants.fromId = curTcpModel.fromId
+                            DeviceChannel.calling = true
+                            Constants.CALL_STATE = Constants.CALL_CALLING
+                            countDownTimer.cancel()
+                        } else if (curTcpModel.getAction() == TcpAction.VoiceAction.REJECT) {//对方拒绝
+                            if (Constants.interactionId == curInteractionVO.id) {
+                                showMessage("对方拒绝")
+                                Constants.CALL_STATE = Constants.CALL_STANDBY
+                                DeviceChannel.calling = false
+                                callEnd(false)
+                            }
+                        } else if (curTcpModel.getAction() == TcpAction.VoiceAction.CALLING) {//对方通话中
+                            showMessage("对方忙线中")
+                            AppTool.Time.delay(800) {
+                                Constants.CALL_STATE = Constants.CALL_STANDBY
+                                DeviceChannel.calling = false
+                                callEnd(false)
+                            }
+                        } else if (curTcpModel.getAction() == TcpAction.VoiceAction.FAILED) {//对方不在线 呼叫失败
+                            //showMessage("对方离线或不存在,呼叫失败")
+                            AppTool.Time.delay(800) {
+                                Constants.CALL_STATE = Constants.CALL_STANDBY
+                                DeviceChannel.calling = false
+                                callEnd(false)
+                            }
+                        }
+                    }
+                }
+            }
+
+            Constants.EVENT_END_CALL -> {
+                if (messageEvent.getMessage() is String) {
+                    val str = messageEvent.getMessage() as String
+                    if (str.equals("cancel")) {
+                        callEnd(false)
+                    } else {
+                        callEnd(true)
+                    }
+                }
+            }
+        }
+    }
+
+}

+ 683 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/SystemSettingsFragment.kt

@@ -0,0 +1,683 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.app.NotificationManager
+import android.content.Context
+import android.content.Intent
+import android.os.Build
+import android.provider.Settings
+import android.util.Log
+import android.view.View
+import android.widget.SeekBar
+import com.enation.javashop.net.engine.model.NetState
+import com.wdkl.ncs.android.component.nursehome.BuildConfig
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentSystemSettingsBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
+import com.wdkl.ncs.android.component.nursehome.util.NetHelper
+import com.wdkl.ncs.android.component.nursehome.util.ScreenManagerUtil
+import com.wdkl.ncs.android.component.nursehome.util.VoiceManagerUtil
+import com.wdkl.ncs.android.component.nursehome.util.WarningDialogHelper
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.SystemSettingsContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.SystemSettingsPresenter
+import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration
+import com.wdkl.ncs.android.middleware.model.dos.PartSettingDO
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_system_settings.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import java.io.DataOutputStream
+import java.io.IOException
+
+/**
+ * 设置Fragment
+ */
+class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystemSettingsBinding>(),SystemSettingsContract.View, View.OnClickListener, SeekBar.OnSeekBarChangeListener {
+    var TAG = SystemSettingsFragment::class.java.getSimpleName()
+    var partSettingDO = PartSettingDO()
+
+    private var clickTime: Long = 0
+    private var clickTimes: Int = 1
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_system_settings
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+        //设置白昼初始值和结束值
+        var initialValue = doubleslide_withoutrule.timeToArray(0, SettingConfig.getInitialDayTime(this.activity))
+        var endValue = doubleslide_withoutrule.timeToArray(1, SettingConfig.getEndOfDay(this.activity))
+
+        Log.e(TAG,"endValue "+endValue +" "+ SettingConfig.getEndOfDay(this.activity)  + ", startValue: " + initialValue + " " + SettingConfig.getInitialDayTime(this.activity))
+//        var initialValue = SettingConfig. getInitialDayTimeLocation(this.activity)
+//        var endValue = SettingConfig.getEndOfDayLocation(this.activity)
+        doubleslide_withoutrule.update(initialValue,endValue)
+
+        if (SettingConfig.TTS_ON == SettingConfig.getTtsMode(this.activity)) {
+            if (Constants.TTS_STATUS == 2) {
+                radio_tts_on.isChecked = true
+            } else {
+                radio_tts_off.isChecked = true
+            }
+        } else {
+            radio_tts_off.isChecked = true
+        }
+
+        if (SettingConfig.getTransferCall(activity)) {
+            radio_transfer_on.isChecked = true
+        } else {
+            radio_transfer_off.isChecked = true
+        }
+
+        //todo 这里实际是应该从服务器拿或者本地拿数据显示
+        //语音播报次数
+        call_number_tv.text = SettingConfig.getCallNumber(this.activity).toString()
+        call_number_seekb.setProgress((SettingConfig.getCallNumber(this.activity)))
+        //主机白天亮度
+        main_engine_daytime_brightness_tv.text = SettingConfig.getMainEngineDaytimeBrightness(this.activity).toString()
+        main_engine_daytime_brightness_seekb.setProgress(SettingConfig.getMainEngineDaytimeBrightness(this.activity))
+        //主机晚上亮度
+        host_night_brightness_tv.text = SettingConfig.getHostNightBrightness(this.activity).toString()
+        host_night_brightness_tv_seekb.setProgress(SettingConfig.getHostNightBrightness(this.activity))
+        //todo 根据白天晚上设置亮度
+
+        //主机白天系统音量
+        host_daytime_volume_tv.text = SettingConfig.getHostDaytimeVolume(this.activity).toString()
+        host_daytime_volume_seekb.setProgress(SettingConfig.getHostDaytimeVolume(this.activity))
+        //主机晚上系统音量
+        host_night_volume_tv.text = SettingConfig.getHostNightVolume(this.activity).toString()
+        host_night_volume_seekb.setProgress(SettingConfig.getHostNightVolume(this.activity))
+        //todo 根据白天晚上设置系统音量
+
+        //主机免提录入音量
+        hands_free_input_volume_of_host_machine_tv.text = SettingConfig.getHandsFreeInputVolumeOfHostMachine(this.activity).toString()
+        hands_free_input_volume_of_host_machine_seekb.setProgress(SettingConfig.getHandsFreeInputVolumeOfHostMachine(this.activity))
+        //主机手柄免提录入音量
+        host_handle_input_volume_tv.text = SettingConfig.getHostHandleInputVolume(this.activity).toString()
+        host_handle_input_volume_seekb.setProgress(SettingConfig.getHostHandleInputVolume(this.activity))
+        //todo 根据白天晚上设置录入音量
+
+
+        //主机免提播放音量
+        host_hands_free_play_volume_tv.text = SettingConfig.getHostHandsFreePlayVolume(this.activity).toString()
+        host_hands_free_play_volume_seekb.setProgress(SettingConfig.getHostHandsFreePlayVolume(this.activity))
+        //主机手柄播放音量
+        host_gamepad_play_volume_tv.text = SettingConfig.getHostGamepadPlayVolume(this.activity).toString()
+        host_gamepad_play_volume_seekb.setProgress(SettingConfig.getHostGamepadPlayVolume(this.activity))
+        //todo 根据白天晚上设置播放音量
+
+        //通话模式
+        if(SettingConfig.single_pass_mode == SettingConfig.getTalkMode(this.activity)){
+            single_pass_mode_radiobt.isChecked = true
+        }else{
+            two_way_mode_radiobt.isChecked = true
+        }
+
+        //分机白天亮度设置
+        extension_daytime_brightness_tv.text = SettingConfig.getExtensionDaytimeBrightness(this.activity).toString()
+        extension_daytime_brightness_seekb.setProgress(SettingConfig.getExtensionDaytimeBrightness(this.activity))
+        //分机晚上亮度设置
+        extension_night_brightness_tv.text = SettingConfig.getExtensionNightBrightness(this.activity).toString()
+        extension_night_brightness_seekb.setProgress(SettingConfig.getExtensionNightBrightness(this.activity))
+        //todo 根据白天晚上设置分机亮度
+
+        //分机LED白天亮度设置
+        extension_daytime_led_brightness_tv.text = SettingConfig.getExtensionDaytimeLEDBrightness(this.activity).toString()
+        extension_daytime_led_brightness_seekb.setProgress(SettingConfig.getExtensionDaytimeLEDBrightness(this.activity))
+        //分机LED晚上亮度设置
+        extension_night_led_brightness_tv.text = SettingConfig.getExtensionNightLEDBrightness(this.activity).toString()
+        extension_night_led_brightness_seekb.setProgress(SettingConfig.getExtensionNightLEDBrightness(this.activity))
+        //todo 根据白天晚上设置分机led亮度
+
+
+        //分机白天系统音量设置
+        extension_daytime_system_volume_tv.text = SettingConfig.getExtensionDaytimeSystemVolume(this.activity).toString()
+        extension_daytime_system_volume_seekb.setProgress(SettingConfig.getExtensionDaytimeSystemVolume(this.activity))
+        //分机晚上统音量设置
+        extension_night_system_volume_tv.text = SettingConfig.getExtensionNightSystemVolume(this.activity).toString()
+        extension_night_system_volume_seekb.setProgress(SettingConfig.getExtensionNightSystemVolume(this.activity))
+        //todo 根据白天晚上设置分机系统音量
+
+        //分机手柄录入音量
+        the_extension_handle_records_the_volume_tv.text = SettingConfig.getTheExtensionHandleRecordsTheVolume(this.activity).toString()
+        the_extension_handle_records_the_volume_seekb.setProgress(SettingConfig.getTheExtensionHandleRecordsTheVolume(this.activity))
+        //todo 根据白天晚上设置分机系统音量
+
+
+        //分机通话音量
+        extension_call_volume_tv.text = SettingConfig.getExtensionCallVolume(this.activity).toString()
+        extension_call_volume_seekb.setProgress(SettingConfig.getExtensionCallVolume(this.activity))
+        //todo 根据白天晚上设置分机通话音量
+
+        //传统转换盒系统音量
+        change_box_system_volume_tv.text = SettingConfig.getChangeBoxSystemVolume(this.activity).toString()
+        change_box_system_volume_seekb.setProgress(SettingConfig.getChangeBoxSystemVolume(this.activity))
+        //todo 根据白天晚上设置传统转换盒系统音量
+
+        //门口机白天亮度设置
+        door_machine_daytime_brightness_tv.text = SettingConfig.getDoorMachineDaytimeBrightness(this.activity).toString()
+        door_machine_daytime_brightness_seekb.setProgress(SettingConfig.getDoorMachineDaytimeBrightness(this.activity))
+        //门口机晚上亮度设置
+        door_machine_night_brightness_tv.text = SettingConfig.getDoorMachineNightBrightness(this.activity).toString()
+        door_machine_night_brightness_seekb.setProgress(SettingConfig.getDoorMachineNightBrightness(this.activity))
+        //todo 根据白天晚上设置门口亮度
+
+        //门口机通话音量
+        door_phone_volume_tv.text = SettingConfig.getDoorPhoneVolume(this.activity).toString()
+        door_phone_volume_seekb.setProgress(SettingConfig.getDoorPhoneVolume(this.activity))
+        //todo 根据白天晚上设置门口通话音量
+        partSettingDO.id = SettingConfiguration.getInstance().id
+        partSettingDO.unionId = SettingConfiguration.getInstance().unionId
+        partSettingDO.createTime = SettingConfiguration.getInstance().createTime
+        partSettingDO.partId = Constants.part_id
+        partSettingDO.dayStart = SettingConfig. getInitialDayTime(this.activity)+":00"
+        partSettingDO.dayLight = SettingConfig.getMainEngineDaytimeBrightness(this.activity)
+        //partSettingDO.dayVol = SettingConfig.getHostDaytimeVolume(this.activity)
+        partSettingDO.dayVol = SettingConfiguration.getInstance().dayVol
+        partSettingDO.dayRingVol = SettingConfig.getHostDaytimeVolume(this.activity)
+        partSettingDO.dayRingTimes = SettingConfig.getCallNumber(this.activity)
+        partSettingDO.dayNurseLed = SettingConfig.getExtensionDaytimeLEDBrightness(this.activity)
+        partSettingDO.dayDoorVol = SettingConfig.getDoorPhoneVolume(this.activity)
+        partSettingDO.dayBedVol = SettingConfig.getExtensionDaytimeSystemVolume(this.activity)
+        partSettingDO.dayTransferBoxVol = SettingConfiguration.getInstance().dayTransferBoxVol
+        partSettingDO.dayTransferBoxSystemVol = SettingConfiguration.getInstance().dayTransferBoxSystemVol
+        partSettingDO.nightStart = SettingConfig.getEndOfDay(this.activity)+":00"
+        partSettingDO.nightLight = SettingConfig.getHostNightBrightness(this.activity)
+        //partSettingDO.nightVol = SettingConfig.getHostNightVolume(this.activity)
+        partSettingDO.nightVol = SettingConfiguration.getInstance().nightVol
+        partSettingDO.nightRingVol = SettingConfig.getHostNightVolume(this.activity)
+        partSettingDO.nightRingTimes = SettingConfig.getCallNumber(this.activity)
+        partSettingDO.nightNurseLed = SettingConfiguration.getInstance().nightNurseLed
+        partSettingDO.nightDoorVol = SettingConfiguration.getInstance().nightDoorVol
+        partSettingDO.nightBedVol = SettingConfig.getExtensionNightSystemVolume(this.activity)
+        partSettingDO.nightTransferBoxVol = SettingConfiguration.getInstance().nightTransferBoxVol
+        partSettingDO.nightTransferBoxSystemVol = SettingConfiguration.getInstance().nightTransferBoxSystemVol
+        partSettingDO.sleepSecondsNurse = SettingConfiguration.getInstance().sleepSecondsNurse
+        partSettingDO.sleepSecondsDoor = SettingConfiguration.getInstance().sleepSecondsDoor
+        partSettingDO.sleepSecondsBed = SettingConfiguration.getInstance().sleepSecondsBed
+        partSettingDO.sipOvertime = SettingConfiguration.getInstance().sipOvertime
+        partSettingDO.transferDuration = SettingConfiguration.getInstance().transferDuration
+        partSettingDO.transferDurationLeader = SettingConfiguration.getInstance().transferDurationLeader
+
+
+        software_and_information_tv.setText("软件版本: V" + BuildConfig.VERSION_NAME + "_" + BuildConfig.VERSION_CODE)
+        software_and_information_tv.setOnLongClickListener {
+            (activity as NurseHomeActivity).checkApp()
+
+            return@setOnLongClickListener true
+        }
+        software_and_information_tv.setOnClickListener {
+            val time = System.currentTimeMillis()
+            if (time - clickTime < 1500) {
+                clickTimes++
+            } else {
+                clickTimes = 1
+            }
+
+            if (clickTimes > 9) {
+                openNetwrokDebug()
+                clickTimes = 1
+            }
+            clickTime = time
+        }
+        tv_device_ip.setText(NetHelper.getInstance().localIP)
+
+        save_settings_tv.setOnClickListener(this)
+        system_settings_tv.setOnClickListener(this)
+    }
+
+    //开启网络调试
+    private fun openNetwrokDebug() {
+        val commands = arrayListOf(
+            "/system/bin/sh",
+            "setprop service.adb.tcp.port 5555",
+            "stop adbd",
+            "start adbd"
+        )
+        try {
+            RunAsRoot(commands)
+            showMessage("打开调试")
+        } catch (e: IOException) {
+            e.printStackTrace()
+        }
+    }
+
+    private fun RunAsRoot(cmds: ArrayList<String>) {
+        val p = Runtime.getRuntime().exec("su")
+        val os = DataOutputStream(p.outputStream)
+        for (tmpCmd in cmds) {
+            os.writeBytes(
+                """
+            $tmpCmd
+            
+            """.trimIndent()
+            )
+        }
+        os.writeBytes("exit\n")
+        os.flush()
+    }
+
+
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+//白昼监听
+        doubleslide_withoutrule.setOnRangeListener { low, big, lowTime, bigTime ->
+            SettingConfig.setInitialDayTimeLocation(this.activity, String.format("%.0f", low))
+            SettingConfig.setInitialDayTime(this.activity,lowTime)
+            SettingConfig.setEndOfDayLocation(this.activity, String.format("%.0f", big))
+            SettingConfig.setEndOfDay(this.activity,bigTime)
+
+            partSettingDO.dayStart = lowTime+":00"
+            partSettingDO.nightStart = bigTime+":00"
+        }
+
+        group_tts_set.setOnCheckedChangeListener { group, checkedId ->
+            if (checkedId == R.id.radio_tts_on) {
+                if (Constants.TTS_STATUS == 2) {
+                    showMessage("TTS启用成功")
+                    SettingConfig.setTtsMode(this.activity, SettingConfig.TTS_ON)
+                } else {
+                    showMessage("TTS不可用,请检查是否已经安装TTS服务")
+                    radio_tts_off.isChecked = true
+                    SettingConfig.setTtsMode(this.activity, SettingConfig.TTS_OFF)
+                }
+            } else if (checkedId == R.id.radio_tts_off) {
+                SettingConfig.setTtsMode(this.activity, SettingConfig.TTS_OFF)
+            }
+        }
+
+        group_call_transfer.setOnCheckedChangeListener { group, checkedId ->
+            if (checkedId == R.id.radio_transfer_on) {
+                SettingConfig.setTransferCall(activity, true)
+                WarningDialogHelper.showDialog(activity)
+            } else {
+                SettingConfig.setTransferCall(activity, false)
+                WarningDialogHelper.showDialog(activity)
+            }
+        }
+
+        //播报次数加减
+        call_number_decrease_tv.setOnClickListener(this)
+        call_number_add_tv.setOnClickListener(this)
+        call_number_seekb.setOnSeekBarChangeListener(this)
+        //主机白天夜晚亮度设置
+        main_engine_daytime_brightness_seekb.setOnSeekBarChangeListener(this)
+        host_night_brightness_tv_seekb.setOnSeekBarChangeListener(this)
+        //主机白天晚上声音设置
+        host_daytime_volume_seekb.setOnSeekBarChangeListener(this)
+        host_night_volume_seekb.setOnSeekBarChangeListener(this)
+        //主机录入音量设置
+        hands_free_input_volume_of_host_machine_seekb.setOnSeekBarChangeListener(this)
+        host_handle_input_volume_seekb.setOnSeekBarChangeListener(this)
+        //主机播放音量设置
+        host_hands_free_play_volume_seekb.setOnSeekBarChangeListener(this)
+        host_gamepad_play_volume_seekb.setOnSeekBarChangeListener(this)
+        //通话模式
+        talk_mode_radiogrp.setOnCheckedChangeListener { radioGroup, i ->
+            if(i == R.id.single_pass_mode_radiobt){//单工模式
+                SettingConfig.setTalkMode(this.activity,SettingConfig.single_pass_mode)
+
+            }else if(i == R.id.two_way_mode_radiobt){//双工模式
+                SettingConfig.setTalkMode(this.activity, SettingConfig.two_way_mode)
+            }
+
+        }
+
+        //分机亮度设置
+        extension_daytime_brightness_seekb.setOnSeekBarChangeListener(this)
+        extension_night_brightness_seekb.setOnSeekBarChangeListener(this)
+        //分机LED亮度设置
+        extension_daytime_led_brightness_seekb.setOnSeekBarChangeListener(this)
+        extension_night_led_brightness_seekb.setOnSeekBarChangeListener(this)
+        //分机系统声音设置
+        extension_daytime_system_volume_seekb.setOnSeekBarChangeListener(this)
+        extension_night_system_volume_seekb.setOnSeekBarChangeListener(this)
+        //分机手柄录入音量
+        the_extension_handle_records_the_volume_seekb.setOnSeekBarChangeListener(this)
+        //分机通话音量
+        extension_call_volume_seekb.setOnSeekBarChangeListener(this)
+        //传统转换盒系统音量
+        change_box_system_volume_seekb.setOnSeekBarChangeListener(this)
+        //门口机晚上亮度音量
+        door_machine_daytime_brightness_seekb.setOnSeekBarChangeListener(this)
+        door_machine_night_brightness_seekb.setOnSeekBarChangeListener(this)
+        //门口机晚上亮度音量
+        door_phone_volume_seekb.setOnSeekBarChangeListener(this)
+    }
+
+    override fun onClick(p0: View) {
+        when (p0.id) {
+            R.id.call_number_decrease_tv -> {
+                call_number_seekb.setProgress(call_number_seekb.progress - 1)
+                partSettingDO.dayRingTimes = call_number_seekb.progress
+                partSettingDO.nightRingTimes = call_number_seekb.progress
+                SettingConfig.setCallNumber(this.activity, partSettingDO.dayRingTimes)
+            }
+            R.id.call_number_add_tv -> {
+                call_number_seekb.setProgress(call_number_seekb.progress + 1)
+                partSettingDO.dayRingTimes = call_number_seekb.progress
+                partSettingDO.nightRingTimes = call_number_seekb.progress
+                SettingConfig.setCallNumber(this.activity, partSettingDO.dayRingTimes)
+            }
+            R.id.save_settings_tv -> {
+                uploadingData(partSettingDO)
+            }
+            R.id.system_settings_tv -> {
+                val intent = Intent(Settings.ACTION_SETTINGS)
+                startActivity(intent)
+            }
+        }
+    }
+
+
+    /**
+     * 滑动过程调用
+     */
+    override fun onProgressChanged(p0: SeekBar, p1: Int, p2: Boolean) {
+        when (p0.id) {
+            R.id.call_number_seekb -> { //播报次数
+                call_number_tv.text = p1.toString()
+            }
+            R.id.main_engine_daytime_brightness_seekb -> {//主机白天亮度
+                main_engine_daytime_brightness_tv.text = p1.toString()
+                ScreenManagerUtil().setScreenBrightness(this.activity, Math.ceil(2.54 * p1).toInt())
+            }
+            R.id.host_night_brightness_tv_seekb -> {//主机夜晚亮度
+                host_night_brightness_tv.text = p1.toString()
+                ScreenManagerUtil().setScreenBrightness(this.activity, Math.ceil(2.54 * p1).toInt())
+            }
+            R.id.host_daytime_volume_seekb -> { //主机白天系统音量
+                host_daytime_volume_tv.text = p1.toString()
+                setTheSystemVolume(p1)
+            }
+            R.id.host_night_volume_seekb -> { //主机夜晚系统音量
+                host_night_volume_tv.text = p1.toString()
+                setTheSystemVolume(p1)
+            }
+            R.id.hands_free_input_volume_of_host_machine_seekb -> { //主机免提录入音量
+                hands_free_input_volume_of_host_machine_tv.text = p1.toString()
+                //todo 这里需要配合语音通话 视屏通话通讯使用
+            }
+            R.id.host_handle_input_volume_seekb -> { //主机手柄录入音量
+                host_handle_input_volume_tv.text = p1.toString()
+                //todo 这里需要配合语音通话 视屏通话通讯使用
+            }
+            R.id.host_hands_free_play_volume_seekb -> { //主机免提播放音量
+                host_hands_free_play_volume_tv.text = p1.toString()
+                //todo 这里需要配合语音通话 视屏通话通讯使用
+            }
+            R.id.host_gamepad_play_volume_seekb -> { //主机手柄播放音量
+                host_gamepad_play_volume_tv.text = p1.toString()
+                //todo 这里需要配合语音通话 视屏通话通讯使用
+            }
+            R.id.extension_daytime_brightness_seekb -> { //分机白天亮度设置
+                extension_daytime_brightness_tv.text = p1.toString()
+            }
+            R.id.extension_night_brightness_seekb -> { //分机晚上亮度设置
+                extension_night_brightness_tv.text = p1.toString()
+            }
+            R.id.extension_daytime_led_brightness_seekb -> { //分机LED白天亮度设置
+                extension_daytime_led_brightness_tv.text = p1.toString()
+            }
+            R.id.extension_night_led_brightness_seekb -> { //分机LED晚上亮度设置
+                extension_night_led_brightness_tv.text = p1.toString()
+            }
+            R.id.extension_daytime_system_volume_seekb -> { //分机白天系统音量
+                extension_daytime_system_volume_tv.text = p1.toString()
+            }
+            R.id.extension_night_system_volume_seekb -> { //分机晚上系统音量
+                extension_night_system_volume_tv.text = p1.toString()
+            }
+            R.id.the_extension_handle_records_the_volume_seekb -> { //分机手柄录入音量
+                the_extension_handle_records_the_volume_tv.text = p1.toString()
+            }
+            R.id.extension_call_volume_seekb -> { //分机通话音量
+                extension_call_volume_tv.text = p1.toString()
+            }
+            R.id.change_box_system_volume_seekb -> { //传统转换盒系统音量
+                change_box_system_volume_tv.text = p1.toString()
+            }
+            R.id.door_machine_daytime_brightness_seekb -> { //门口机白天亮度
+                door_machine_daytime_brightness_tv.text = p1.toString()
+            }
+            R.id.door_machine_night_brightness_seekb -> { //门口机晚上亮度
+                door_machine_night_brightness_tv.text = p1.toString()
+            }
+            R.id.door_phone_volume_seekb -> { //门口机通话音量
+                door_phone_volume_tv.text = p1.toString()
+            }
+
+        }
+    }
+
+    /**
+     * 滑动开始调用
+     */
+    override fun onStartTrackingTouch(p0: SeekBar) {
+
+    }
+
+    /**
+     * 滑动停止调用
+     */
+    override fun onStopTrackingTouch(p0: SeekBar) {
+        //todo 保存到本地并上传到服务器
+        when (p0.id) {
+            R.id.call_number_seekb -> { //播报次数
+                SettingConfig.setCallNumber(this.activity,p0.progress)
+                partSettingDO.dayRingTimes = p0.progress
+                partSettingDO.nightRingTimes = p0.progress
+            }
+            R.id.main_engine_daytime_brightness_seekb -> { //主机白天亮度
+                SettingConfig.setMainEngineDaytimeBrightness(this.activity,p0.progress)
+                partSettingDO.dayLight = p0.progress
+            }
+            R.id.host_night_brightness_tv_seekb -> { //主机夜晚亮度
+                SettingConfig.setHostNightBrightness(this.activity,p0.progress)
+                partSettingDO.nightLight = p0.progress
+            }
+            R.id.host_daytime_volume_seekb -> { //主机白天系统音量
+                SettingConfig.setHostDaytimeVolume(this.activity,p0.progress)
+                //partSettingDO.dayVol = p0.progress
+                partSettingDO.dayRingVol = p0.progress
+            }
+            R.id.host_night_volume_seekb -> { //主机夜晚系统音量
+                SettingConfig.setHostNightVolume(this.activity,p0.progress)
+                //partSettingDO.nightVol = p0.progress
+                partSettingDO.nightRingVol = p0.progress
+            }
+
+            R.id.hands_free_input_volume_of_host_machine_seekb -> { //主机免提录入音量
+                SettingConfig.setHandsFreeInputVolumeOfHostMachine(this.activity,p0.progress)
+            }
+            R.id.host_handle_input_volume_seekb -> { //主机手柄录入音量
+                SettingConfig.setHostHandleInputVolume(this.activity,p0.progress)
+            }
+            R.id.host_hands_free_play_volume_seekb -> { //主机免提播放音量
+                SettingConfig.setHostHandsFreePlayVolume(this.activity,p0.progress)
+            }
+            R.id.host_gamepad_play_volume_seekb -> { //主机手柄播放音量
+                SettingConfig.setHostGamepadPlayVolume(this.activity,p0.progress)
+            }
+            R.id.extension_daytime_brightness_seekb -> { //分机白天亮度设置
+                SettingConfig.setExtensionDaytimeBrightness(this.activity,p0.progress)
+            }
+            R.id.extension_night_brightness_seekb -> { //分机晚上亮度设置
+                SettingConfig.setExtensionNightBrightness(this.activity,p0.progress)
+            }
+            R.id.extension_daytime_led_brightness_seekb -> { //分机LED白天亮度设置
+                SettingConfig.setExtensionDaytimeLEDBrightness(this.activity,p0.progress)
+                partSettingDO.dayNurseLed = p0.progress
+            }
+            R.id.extension_night_led_brightness_seekb -> { //分机LED晚上亮度设置
+                SettingConfig.setExtensionNightLEDBrightness(this.activity,p0.progress)
+                partSettingDO.nightNurseLed = p0.progress
+            }
+            R.id.extension_daytime_system_volume_seekb -> { //分机白天系统音量
+                SettingConfig.setExtensionDaytimeSystemVolume(this.activity,p0.progress)
+                partSettingDO.dayBedVol = p0.progress
+            }
+            R.id.extension_night_system_volume_seekb -> { //分机晚上系统音量
+                SettingConfig.setExtensionNightSystemVolume(this.activity,p0.progress)
+                partSettingDO.nightBedVol = p0.progress
+            }
+            R.id.the_extension_handle_records_the_volume_seekb -> { //分机手柄录入音量
+                SettingConfig.setTheExtensionHandleRecordsTheVolume(this.activity,p0.progress)
+            }
+            R.id.extension_call_volume_seekb -> { //分机通话音量
+                SettingConfig.setExtensionCallVolume(this.activity,p0.progress)
+            }
+            R.id.change_box_system_volume_seekb -> { //传统转换盒系统音量
+                SettingConfig.setChangeBoxSystemVolume(this.activity,p0.progress)
+                partSettingDO.dayTransferBoxSystemVol = p0.progress
+                partSettingDO.dayTransferBoxVol = p0.progress
+                partSettingDO.nightTransferBoxSystemVol = p0.progress
+                partSettingDO.nightTransferBoxVol = p0.progress
+            }
+            R.id.door_machine_daytime_brightness_seekb -> { //门口机白天亮度
+                SettingConfig.setDoorMachineDaytimeBrightness(this.activity,p0.progress)
+            }
+            R.id.door_machine_night_brightness_seekb -> { //门口机晚上亮度
+                SettingConfig.setDoorMachineNightBrightness(this.activity,p0.progress)
+            }
+            R.id.door_phone_volume_seekb -> { //门口机通话音量
+                SettingConfig.setDoorPhoneVolume(this.activity,p0.progress)
+                partSettingDO.dayDoorVol = p0.progress
+                partSettingDO.nightDoorVol = p0.progress
+            }
+        }
+    }
+
+    /**
+     * 设置系统音量
+     */
+    fun setTheSystemVolume(value:Int){
+        //todo 这里需要优化 滑动的时候会调起很多个打开权限的界面
+        if (value <= 15) {
+            val nm = this.activity.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !nm.isNotificationPolicyAccessGranted) {
+//                showAlterDialog()
+
+                val intent = Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS)
+                startActivity(intent)
+
+            } else {
+                VoiceManagerUtil.setSystemVoice(this.activity, value)
+                VoiceManagerUtil.setMusicVoice(this.activity, value)
+            }
+        } else {
+            VoiceManagerUtil.setSystemVoice(this.activity, value)
+            VoiceManagerUtil.setMusicVoice(this.activity, value)
+        }
+
+    }
+
+   fun uploadingData(partSettingDO:PartSettingDO){
+//       createTime: Int, updateTime: Int, partId: Int, dayStart: String, dayLight: Int,
+//       dayVol: Int, dayRingVol: Int, dayRingTimes: Int, dayNurseLed: Int, dayDoorVol: Int,
+//       dayBedVol: Int, dayTransferBoxVol: Int, dayTransferBoxSystemVol: Int, nightStart: String,
+//       nightLight: Int, nightVol: Int, nightRingVol: Int, nightRingTimes: Int, nightNurseLed: Int,
+//       nightDoorVol: Int, nightBedVol: Int, nightTransferBoxVol: Int, nightTransferBoxSystemVol: Int,
+//       sleepSecondsNurse: Int, sleepSecondsDoor: Int, sleepSecondsBed: Int, sipOvertime: Int) {
+       if(SettingConfiguration.getInstance().id != null) {
+           partSettingDO.updateTime = System.currentTimeMillis()/1000
+           presenter.setSettingData(
+               partSettingDO.id,
+               partSettingDO.unionId,
+               partSettingDO.createTime.toInt(),
+               partSettingDO.updateTime.toInt(),
+               partSettingDO.partId,
+               partSettingDO.dayStart,
+               partSettingDO.dayLight,
+               partSettingDO.dayVol,
+               partSettingDO.dayRingVol,
+               partSettingDO.dayRingTimes,
+               partSettingDO.dayNurseLed,
+               partSettingDO.dayDoorVol,
+               partSettingDO.dayBedVol,
+               partSettingDO.dayTransferBoxVol,
+               partSettingDO.dayTransferBoxSystemVol,
+               partSettingDO.nightStart,
+               partSettingDO.nightLight,
+               partSettingDO.nightVol,
+               partSettingDO.nightRingVol,
+               partSettingDO.nightRingTimes,
+               partSettingDO.nightNurseLed,
+               partSettingDO.nightDoorVol,
+               partSettingDO.nightBedVol,
+               partSettingDO.nightTransferBoxVol,
+               partSettingDO.nightTransferBoxSystemVol,
+               partSettingDO.sleepSecondsNurse,
+               partSettingDO.sleepSecondsDoor,
+               partSettingDO.sleepSecondsBed,
+               partSettingDO.sipOvertime,
+               partSettingDO.transferDuration,
+               partSettingDO.transferDurationLeader
+           )
+       }else{
+           showMessage("参数设置失败")
+       }
+
+   }
+
+    /**
+     *面销毁回调
+     */
+    override fun destory() {
+    }
+
+    override fun showData(data: PartSettingDO) {
+        showMessage("参数设置成功")
+        (activity as NurseHomeActivity).showHome()
+    }
+
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}

+ 83 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/TrustManagementFragment.kt

@@ -0,0 +1,83 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import com.enation.javashop.net.engine.model.NetState
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentTrustManagementBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.TrustManagementContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.TrustManagementPresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 托管Fragment
+ */
+class TrustManagementFragment:BaseFragment<TrustManagementPresenter,FragmentTrustManagementBinding>(),TrustManagementContract.View {
+    var TAG = TrustManagementFragment::class.java.getSimpleName()
+
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_trust_management
+    }
+    /**
+     *初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    /**
+     *初始化操作
+     */
+    override fun init() {
+    }
+    /**
+     *绑定事件
+     */
+    override fun bindEvent() {
+    }
+    /**
+     *页面销毁回调
+     */
+    override fun destory() {
+    }
+    /**
+     *显示数据
+     */
+    override fun showData() {
+    }
+    /**
+     *处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+    /**
+     *耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+    /**
+     *耗时加载开始
+     */
+    override fun start() {
+    }
+    /**
+     *处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}

+ 172 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/fragment/VisitManagementFragment.kt

@@ -0,0 +1,172 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.util.Log
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.scwang.smartrefresh.layout.footer.ClassicsFooter
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.VisitManagementAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentVisitManagementBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.vo.filter
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.VisitManagementContract
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.VisitManagementPresenter
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import kotlinx.android.synthetic.main.fragment_visit_management.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/***
+ * 探视管理Fragment
+ */
+class VisitManagementFragment: BaseFragment<VisitManagementPresenter,FragmentVisitManagementBinding>(),VisitManagementContract.View {
+    var TAG = VisitManagementFragment::class.java.getSimpleName()
+
+
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+    //护士适配器
+    var visitManagementAdapter: VisitManagementAdapter? = null
+    
+    
+    /**
+     * 提供layoutID
+     */
+    override fun getLayId(): Int {
+        return R.layout.fragment_visit_management
+    }
+
+    /**
+     * 初始化依赖注入
+     */
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    /**
+     * 初始化操作
+     */
+    override fun init() {
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+
+        visitManagementAdapter = VisitManagementAdapter(ArrayList())
+        delegateAdapter.addAdapter(visitManagementAdapter)
+        mViewDataBinding.visitTheHostRefresh.setRefreshFooter(ClassicsFooter(activity))
+
+        /**配置到RecycleView*/
+        visit_the_host_recyv.layoutManager = virtualLayoutManager
+        visit_the_host_recyv.adapter = delegateAdapter
+
+
+        //临时模拟测试数据
+        var visit_the_hostList = ArrayList<String>()
+        visit_the_hostList.add("探视分机1")
+        visit_the_hostList.add("探视分机2")
+        visit_the_hostList.add("探视分机3")
+        visit_the_hostList.add("探视分机4")
+        visit_the_hostList.add("探视分机5")
+        visit_the_hostList.add("探视分机6")
+        visit_the_hostList.add("探视分机7")
+        visit_the_hostList.add("探视分机8")
+        visit_the_hostList.add("探视分机9")
+        visit_the_hostList.add("探视分机10")
+        visit_the_hostList.add("探视分机11")
+
+        visitManagementAdapter!!.data.clear()
+        visitManagementAdapter!!.data.addAll(visit_the_hostList)
+        Log.i(TAG,"探视主机数量 " + visit_the_hostList.size)
+        visitManagementAdapter!!.notifyDataSetChanged()
+
+
+
+        /**初始化LayoutMannager*/
+        virtualLayoutManager = VirtualLayoutManager(this.activity)
+        /**初始化适配器*/
+        delegateAdapter = DelegateAdapter(virtualLayoutManager)
+        visitManagementAdapter = VisitManagementAdapter(ArrayList())
+        delegateAdapter.addAdapter(visitManagementAdapter)
+        mViewDataBinding.visualExtensionRefresh.setRefreshFooter(ClassicsFooter(activity))
+
+        /**配置到RecycleView*/
+        visual_extension_recyv.layoutManager = virtualLayoutManager
+        visual_extension_recyv.adapter = delegateAdapter
+        //临时模拟测试数据
+        var visualExtensionList = ArrayList<String>()
+        visualExtensionList.add("可视分机1")
+        visualExtensionList.add("可视分机2")
+        visualExtensionList.add("可视分机3")
+        visualExtensionList.add("可视分机4")
+        visualExtensionList.add("可视分机5")
+        visualExtensionList.add("可视分机6")
+        visualExtensionList.add("可视分机7")
+        visualExtensionList.add("可视分机8")
+        visualExtensionList.add("可视分机9")
+        visualExtensionList.add("可视分机10")
+        visualExtensionList.add("可视分机11")
+
+        visitManagementAdapter!!.data.clear()
+        visitManagementAdapter!!.data.addAll(visualExtensionList)
+        Log.i(TAG,"可视分机数量 " + visualExtensionList.size)
+        visitManagementAdapter!!.notifyDataSetChanged()
+        
+        
+    }
+
+    /**
+     * 绑定事件
+     */
+    override fun bindEvent() {
+    }
+
+    /**
+     * 页面销毁回调
+     */
+    override fun destory() {
+    }
+
+    /**
+     * 显示数据
+     */
+    override fun showData() {
+    }
+
+    /**
+     * 处理错误信息
+     */
+    override fun onError(message: String, type: Int) {
+    }
+
+    /**
+     * 耗时加载完成
+     */
+    override fun complete(message: String, type: Int) {
+    }
+
+    /**
+     * 耗时加载开始
+     */
+    override fun start() {
+    }
+
+    /**
+     * 处理网络状态
+     */
+    override fun networkMonitor(state: NetState) {
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+//        Log.e(TAG,"收到tcp消息")
+//        var messageEvent = messageEvent.getMessage() as TcpModel
+//        if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
+//
+//            Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
+//        }
+    }
+}

+ 24 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/launch/NurseHomeLaunch.kt

@@ -0,0 +1,24 @@
+package com.wdkl.ncs.android.component.nursehome.launch
+
+import com.enation.javashop.android.jrouter.external.annotation.Router
+import com.wdkl.ncs.android.component.nursehome.di.DaggerNurseHomeComponent
+import com.wdkl.ncs.android.component.nursehome.di.NurseHomeComponent
+import com.wdkl.ncs.android.lib.base.BaseLaunch
+import com.wdkl.ncs.android.middleware.di.DaggerManager
+
+/**
+ * home模块启动类 代替Application 在壳工程Application中反射调用
+ */
+@Router(path = "/nursehome/launch")
+class NurseHomeLaunch : BaseLaunch() {
+    companion object {
+        lateinit var component: NurseHomeComponent
+    }
+
+    override fun moduleInit() {
+        component = DaggerNurseHomeComponent
+                .builder()
+                .applicationComponent(DaggerManager.APPLICATION_COMPONENT)
+                .build()
+    }
+}

+ 546 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedC2MManager.java

@@ -0,0 +1,546 @@
+package com.wdkl.ncs.android.component.nursehome.led;
+
+import android.app.Application;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.listenvision.LedC2M;
+import com.listenvision.model.VoiceModel;
+import com.wdkl.ncs.android.component.nursehome.common.Constants;
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig;
+import com.wdkl.ncs.android.lib.utils.ExtendMethodsKt;
+import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TimerTask;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+public class LedC2MManager extends LedManager {
+    private static final String TAG = "ledC2M";
+
+    private Application application;
+    private LedC2M ledC2M;
+    private static ArrayList<LedItem> ledList = new ArrayList<>();
+    private static List<LedProgram> programTextList = new ArrayList<>();
+    private static List<String> voiceProgramList = new ArrayList<>();
+    private static String voiceText;
+    private static String deleteVoiceText;
+    private static boolean stopVoice = false;
+
+    private static long LED_TIMEOUT = 5*60*1000L;
+
+    private final static Object lockObject = new Object();
+
+    private boolean isPowerOn = true;
+
+    @Override
+    public void init(Application application) {
+        ledC2M = new LedC2M();
+        ledC2M.init(application);
+        this.application = application;
+        File file = new File(Constants.Companion.getC2M_LED_FONT_PATH());
+        if (file.exists()) {
+            Constants.Companion.setLedFontExist(true);
+        } else {
+            copyFont();
+        }
+
+        initScheduledExecutor();
+    }
+
+    @Override
+    public void copyFont() {
+        super.copyFont();
+        if (ledC2M != null) {
+            ledC2M.copyFontFile(new LedC2M.LedFontCheck() {
+                @Override
+                public void onChecked(boolean check) {
+                    Constants.Companion.setLedFontExist(check);
+                    ExtendMethodsKt.showMessage("字库文件copy完成...");
+                    Log.d(TAG, "led font copy end...");
+                }
+            });
+        }
+    }
+
+    private void initScheduledExecutor() {
+        TimerTask timerTask = new TimerTask() {
+            @Override
+            public void run() {
+                synchronized (lockObject) {
+                    //每分钟查询一次点阵屏节目,超过5分钟的将自动移除
+                    Iterator<LedProgram> iterator = programTextList.iterator();
+                    long curTime = System.currentTimeMillis();
+                    boolean update = false;
+                    while (iterator.hasNext()) {
+                        if (curTime - iterator.next().getTime() > LED_TIMEOUT) {
+                            iterator.remove();
+                            update = true;
+                        }
+                    }
+
+                    if (update) {
+                        sendProgramStart();
+                    }
+                }
+            }
+        };
+        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
+        executor.scheduleAtFixedRate(timerTask,60,90, TimeUnit.SECONDS);
+    }
+
+    @Override
+    public void initIpList() {
+        getLedDeviceIpList();
+    }
+
+    private void getLedDeviceIpList() {
+        //
+    }
+
+    @Override
+    public void setLedIpList(ArrayList<LedItem> list) {
+        ledList.clear();
+        ledList.addAll(list);
+    }
+
+    @Override
+    public ArrayList<LedItem> getLedList() {
+        return ledList;
+    }
+
+    private final ExecutorService updateThreadPool = Executors.newSingleThreadExecutor();
+    private SendProgramThread programThread;
+
+    //语音节目udp
+    private void sendVoiceUdp(String ip) {
+        int server_port = 9999;
+        String text = "";
+        byte[] data;
+
+        if (stopVoice) {
+            data = VoiceModel.getStopVoiceData();
+        } else {
+            text = voiceText;
+            for (int j = 0; j < 2; j++) {
+                text = text + "," + voiceText;
+            }
+            data = VoiceModel.getVoiceData(text);
+        }
+
+        DatagramSocket s = null;
+        try {
+            s = new DatagramSocket();
+        } catch (SocketException e) {
+            e.printStackTrace();
+        }
+        InetAddress local = null;
+        try {
+            local = InetAddress.getByName(ip);
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+
+        if (data != null) {
+            if (Constants.Companion.getDEBUG()) {
+                Log.d(TAG, "udp send voice text: " + voiceText + ", voice data hex string: " + VoiceModel.bytesToHexString(data));
+            }
+            DatagramPacket p = new DatagramPacket(data, data.length, local,
+                    server_port);
+            try {
+                s.send(p);
+                s.close();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    //语音节目-tcp
+    private void sendVoiceTcp(String ip) {
+        try {
+            byte[] data;
+            String text = "";
+
+            if (stopVoice) {
+                data = VoiceModel.getStopVoiceData();
+            } else {
+                text = voiceText;
+                int loop = Constants.Companion.getLedVoiceTimes()-1;
+                for (int j = 0; j < loop; j++) {
+                    text = text + "," + voiceText;
+                }
+                String volume = Integer.toString(Constants.Companion.getLedVoiceVolume());
+                text = "[v" + volume +"]" + text;
+                data = VoiceModel.getVoiceData(text);
+            }
+
+            Socket socket = new Socket(ip, 10000);
+            OutputStream outputStream = socket.getOutputStream();
+            if (Constants.Companion.getDEBUG()) {
+                Log.d(TAG, "socket connect: " + socket.isConnected());
+            }
+
+            if (socket.isConnected() && data != null) {
+                if (Constants.Companion.getDEBUG()) {
+                    Log.d(TAG, "tcp send voice text: " + voiceText + ", voice data hex string: " + VoiceModel.bytesToHexString(data));
+                }
+                outputStream.write(data);
+                socket.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    //文字节目
+    public class SendProgramThread implements Runnable {
+
+        @Override
+        public void run() {
+            //开始组建节目: 如果字体文件不存在则直接返回
+            if (!Constants.Companion.getLedFontExist()) {
+                return;
+            }
+
+            if (ledList.size() == 0) {
+                return;
+            }
+
+            int infoType = SettingConfig.getLedInfoType(application);
+            if (programTextList.size() == 0) {
+                //默认节目
+                for (LedItem ledItem : ledList) {
+                    if (ledItem != null) {
+                        //停止语音
+                        stopVoice = true;
+                        long h = createDefaultProgram(ledItem.getResolution(), ledItem.getFontSize(), infoType, 3);
+                        if (h != 0) {
+                            int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
+                            //语音节目
+                            if (ledItem.getVoiceOn()) {
+                                sendVoiceTcp(ledItem.getIp());
+                            }
+
+                            if (Constants.Companion.getDEBUG()) {
+                                Log.d(TAG, "send default program to " + ledItem.getIp() + ", result: " + result);
+                            }
+                            ledC2M.DeleteProgram(h);
+                        }
+                    }
+                }
+            } else {
+                //呼叫信息节目
+                //当前正在播放的语音和将要移除的语音相同
+                if (voiceProgramList.size() > 0) {
+                    voiceText = voiceProgramList.get(0);
+                    if (voiceText.equals(deleteVoiceText)) {
+                        stopVoice = true;
+                    } else {
+                        stopVoice = false;
+                    }
+                    voiceProgramList.remove(voiceText);
+                } else {
+                    stopVoice = true;
+                }
+                Log.d(TAG, "voiceText: " + voiceText + ", deleteVoiceText: " + deleteVoiceText);
+
+                for (LedItem ledItem : ledList) {
+                    if (ledItem != null) {
+                        long h = createCallingProgram(ledItem.getResolution(), ledItem.getFontSize());
+                        if (h != 0) {
+                            int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
+                            //语音节目
+                            if (ledItem.getVoiceOn()) {
+                                sendVoiceTcp(ledItem.getIp());
+                            }
+
+                            if (Constants.Companion.getDEBUG()) {
+                                Log.d(TAG, "send calling program to " + ledItem.getIp() + ", result: " + result);
+                            }
+                            ledC2M.DeleteProgram(h);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private long createDefaultProgram(String ledResolution, int fontSize, int type, int savaType) {
+        long hProgram = 0;
+        if (type == 0) {
+            //仅显示时间
+            if (LedItem.TYPE_64_16.equals(ledResolution)) {
+                //64x16
+                hProgram = ledC2M.CreateProgram(64, 16, 1,1,savaType);
+                ledC2M.AddProgram(hProgram, 0, 10, 1);
+                ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 64, 16, Constants.Companion.getC2M_LED_FONT_PATH(),
+                        16, 0xff, 0, 0, 0,
+                        0, 0, 0, 0, 1, 1, 0,
+                        0, 0xff, 0, 0xff, 2, 0xff, 1);
+            } else if (LedItem.TYPE_128_16.equals(ledResolution)) {
+                //128x16
+                hProgram = ledC2M.CreateProgram(128, 16, 1,1,savaType);
+                ledC2M.AddProgram(hProgram, 0, 10, 1);
+                ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constants.Companion.getC2M_LED_FONT_PATH(),
+                        16, 0xff, 0, 0, 0,
+                        1, 0, 1, 1, 1, 1, 0,
+                        4, 0xff, 0, 0xff, 2, 0xff, 0);
+            } else {
+                //默认为128x32
+                hProgram = ledC2M.CreateProgram(128, 32, 1,1, savaType);
+                ledC2M.AddProgram(hProgram, 0, 10, 1);
+                ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
+                        16, 0xff, 0, 0, 0,
+                        1, 0, 1, 1, 1, 1, 1,
+                        0, 0xff, 0, 0xff, 2, 0xff, 1);
+            }
+        } else if (type == 1) {
+            //显示时间和自定义内容
+            String text = SettingConfig.getLedCustomInfo(application);
+            if (LedItem.TYPE_64_16.equals(ledResolution)) {
+                //64x16
+                hProgram = ledC2M.CreateProgram(64, 16, 1,1,savaType);
+                ledC2M.AddProgram(hProgram, 0, 10, 1);
+                ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 64, 16, Constants.Companion.getC2M_LED_FONT_PATH(),
+                        16, 0xff, 0, 0, 0,
+                        0, 0, 0, 0, 1, 1, 0,
+                        0, 0xff, 0, 0xff, 2, 0xff, 1);
+                if (!TextUtils.isEmpty(text)) {
+                    ledC2M.AddProgram(hProgram, 1, 10, 1);
+                    ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 64, 16, 0);
+                    ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
+                }
+            } else if (LedItem.TYPE_128_16.equals(ledResolution)){
+                //128x16
+                hProgram = ledC2M.CreateProgram(128, 16, 1,1,savaType);
+                ledC2M.AddProgram(hProgram, 0, 10, 1);
+                ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 16, Constants.Companion.getC2M_LED_FONT_PATH(),
+                        16, 0xff, 0, 0, 0,
+                        1, 0, 1, 1, 1, 1, 0,
+                        4, 0xff, 0, 0xff, 2, 0xff, 0);
+                if (!TextUtils.isEmpty(text)) {
+                    ledC2M.AddProgram(hProgram, 1, 10, 1);
+                    ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 16, 0);
+                    ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
+                }
+            } else {
+                //128x32
+                hProgram = ledC2M.CreateProgram(128, 32, 1,1,savaType);
+                ledC2M.AddProgram(hProgram, 0, 10, 1);
+                ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.Companion.getC2M_LED_FONT_PATH(),
+                        16, 0xff, 0, 0, 0,
+                        1, 0, 1, 1, 1, 1, 1,
+                        0, 0xff, 0, 0xff, 2, 0xff, 1);
+
+                if (!TextUtils.isEmpty(text)) {
+                    ledC2M.AddProgram(hProgram, 1, 10, 1);
+                    ledC2M.AddImageTextArea(hProgram, 1, 1, 0, 0, 128, 32, 0);
+                    ledC2M.AddMultiLineTextToImageTextArea(hProgram, 1, 1, 0, text, Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
+                }
+            }
+        }
+
+        return hProgram;
+    }
+
+    private long createCallingProgram(String ledResolution, int fontSize) {
+        long hProgram = 0;
+        if (LedItem.TYPE_64_16.equals(ledResolution)) {
+            //64x16
+            hProgram = ledC2M.CreateProgram(64, 16, 1, 1, 3);
+            for (int i = 0; i < programTextList.size(); i++) {
+                String text = programTextList.get(i).getText();
+                ledC2M.AddProgram(hProgram, i, Constants.Companion.getLedProgramTime(), 1);
+                ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 64, 16, 0);
+                ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, text.replace("紧急呼叫", "呼叫"), Constants.Companion.getC2M_LED_FONT_PATH(), 16, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
+            }
+        } else if (LedItem.TYPE_128_16.equals(ledResolution)){
+            //128x16
+            hProgram = ledC2M.CreateProgram(128, 16, 1, 1, 3);
+            for (int i = 0; i < programTextList.size(); i++) {
+                ledC2M.AddProgram(hProgram, i, Constants.Companion.getLedProgramTime(), 1);
+                ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 16, 0);
+                ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
+            }
+        } else {
+            //128x32
+            hProgram = ledC2M.CreateProgram(128, 32, 1, 1, 3);
+            for (int i = 0; i < programTextList.size(); i++) {
+                ledC2M.AddProgram(hProgram, i, Constants.Companion.getLedProgramTime(), 1);
+                ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 32, 0);
+                ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i).getText(), Constants.Companion.getC2M_LED_FONT_PATH(), fontSize, 0xff, 0, 0, 0, 4, 5, 3, 1, 1);
+            }
+        }
+
+        return hProgram;
+    }
+
+
+    //更新节目方法: text -- 节目内容,action -- 方式: 1-发送节目,2-删除节目
+    @Override
+    public synchronized void updateProgram(String text, int action) {
+        synchronized (lockObject) {
+            if (text == null) {
+                return;
+            }
+
+            switch (action) {
+                case 1:
+                    //先查找列表中是否存在该节目,存在则删除
+                    Iterator<LedProgram> iterator = programTextList.iterator();
+                    while (iterator.hasNext()) {
+                        if (text.equals(iterator.next().getText())) {
+                            iterator.remove();
+                        }
+                    }
+
+                    LedProgram ledProgram = new LedProgram(text, System.currentTimeMillis());
+                    programTextList.add(0, ledProgram);
+                    voiceProgramList.add(0, text);
+                    deleteVoiceText = "";
+                    break;
+                case 2:
+                    boolean deleted = false;
+                    Iterator<LedProgram> iterator2 = programTextList.iterator();
+                    while (iterator2.hasNext()) {
+                        if (text.equals(iterator2.next().getText())) {
+                            iterator2.remove();
+                            deleteVoiceText = text;
+                            deleted = true;
+                            break;
+                        }
+                    }
+                    if (!deleted) {
+                        return;
+                    }
+                    break;
+            }
+
+            sendProgramStart();
+        }
+    }
+
+    private void sendProgramStart() {
+        if (programThread == null) {
+            programThread = new SendProgramThread();
+        }
+        updateThreadPool.execute(programThread);
+    }
+
+    private void sendDefaulProgram(final boolean needReboot) {
+        //停止语音
+        stopVoice = true;
+
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                synchronized (lockObject) {
+                    //如果字体文件不存在则直接返回
+                    if (!Constants.Companion.getLedFontExist()) {
+                        return;
+                    }
+
+                    if (ledList.size() == 0) {
+                        return;
+                    }
+
+                    int infoType = SettingConfig.getLedInfoType(application);
+                    for (LedItem ledItem : ledList) {
+                        if (ledItem != null) {
+                            long h = createDefaultProgram(ledItem.getResolution(), ledItem.getFontSize(), infoType, 0);
+                            if (h != 0) {
+                                int result = ledC2M.NetWorkSend(ledItem.getIp(), h);
+                                //语音节目
+                                //if (Constants.Companion.getLedVoiceOn() == 1) {
+                                //    sendVoiceTcp(ledItem.getIp());
+                                //}
+
+                                if (Constants.Companion.getDEBUG()) {
+                                    Log.d(TAG, "send default program to " + ledItem.getIp() + ", result: " + result);
+                                }
+                                ledC2M.DeleteProgram(h);
+                            }
+
+                            if (needReboot) {
+                                ledC2M.PowerOnOff(ledItem.getIp(), 2);
+                            }
+                        }
+                    }
+                }
+            }
+        }).start();
+    }
+
+    @Override
+    public void updateDefaultProgram() {
+        //无呼叫节目时更新默认节目
+        if (programTextList.size() == 0) {
+            sendDefaulProgram(true);
+        }
+    }
+
+    @Override
+    public void removeAllProgram() {
+        programTextList.clear();
+        sendDefaulProgram(true);
+    }
+
+    @Override
+    public void syncTime() {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                synchronized (lockObject) {
+                    for (int i = 0; i < ledList.size(); i++) {
+                        ledC2M.AdjustTime(ledList.get(i).getIp());
+                    }
+                }
+            }
+        }).start();
+    }
+
+    @Override
+    public void powerOnOff() {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                synchronized (lockObject) {
+                    if (isPowerOn) {
+                        for (int i = 0; i < ledList.size(); i++) {
+                            ledC2M.PowerOnOff(ledList.get(i).getIp(), 1);
+                        }
+                        isPowerOn = false;
+                    } else {
+                        for (int i = 0; i < ledList.size(); i++) {
+                            ledC2M.PowerOnOff(ledList.get(i).getIp(), 0);
+                        }
+                        isPowerOn = true;
+                    }
+                }
+            }
+        }).start();
+    }
+
+    @Override
+    public void release() {
+        programTextList.clear();
+    }
+}

+ 59 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedItem.java

@@ -0,0 +1,59 @@
+package com.wdkl.ncs.android.component.nursehome.led;
+
+public class LedItem {
+    /*
+    * Led点阵屏相关参数:
+    * type:点阵屏类型,128x32代表128x32点阵,64x16代表64x16点阵,默认为128x32
+     */
+
+    public static final String TYPE_128_32 = "128x32";
+    public static final String TYPE_128_16 = "128x16";
+    public static final String TYPE_64_16 = "64x16";
+
+    private String resolution;
+    private String ip;
+    private boolean voiceOn;
+    private int fontSize;
+
+    public LedItem() {
+    }
+
+    public LedItem(String resolution, String ip, boolean voiceOn, int fontSize) {
+        this.resolution = resolution;
+        this.ip = ip;
+        this.voiceOn = voiceOn;
+        this.fontSize = fontSize;
+    }
+
+    public String getResolution() {
+        return resolution;
+    }
+
+    public void setResolution(String resolution) {
+        this.resolution = resolution;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    public boolean getVoiceOn() {
+        return voiceOn;
+    }
+
+    public void setVoiceOn(boolean voiceOn) {
+        this.voiceOn = voiceOn;
+    }
+
+    public int getFontSize() {
+        return fontSize;
+    }
+
+    public void setFontSize(int fontSize) {
+        this.fontSize = fontSize;
+    }
+}

+ 52 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedManager.java

@@ -0,0 +1,52 @@
+package com.wdkl.ncs.android.component.nursehome.led;
+
+import android.app.Application;
+
+import com.wdkl.ncs.android.component.nursehome.common.Constants;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class LedManager {
+
+    //初始化
+    public abstract void init(Application application);
+
+    //获取所有LED屏ip地址
+    public abstract void initIpList();
+
+    public abstract void setLedIpList(ArrayList<LedItem> list);
+
+    //获取点阵屏列表
+    public abstract ArrayList<LedItem> getLedList();
+
+    //更新节目: text -- 节目内容,action -- 方式: 1-发送节目,2-删除节目,3-发送默认节目
+    public abstract void updateProgram(String text, int action);
+
+    //更新默认节目
+    public abstract void updateDefaultProgram();
+
+    public abstract void removeAllProgram();
+
+    public abstract void syncTime();
+
+    public abstract void powerOnOff();
+
+    public abstract void release();
+
+    public long checkLedFont() {
+        File file = new File(Constants.Companion.getC2M_LED_FONT_PATH());
+        if (file.exists()) {
+            Constants.Companion.setLedFontExist(true);
+            return file.length();
+        } else {
+            Constants.Companion.setLedFontExist(false);
+            return -1;
+        }
+    }
+
+    public void copyFont() {
+        //
+    }
+}

+ 103 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedManagerUtils.java

@@ -0,0 +1,103 @@
+package com.wdkl.ncs.android.component.nursehome.led;
+
+import android.app.Application;
+
+import com.wdkl.ncs.android.lib.utils.ExtendMethodsKt;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class LedManagerUtils {
+    private static LedManagerUtils instance = null;
+    private LedManager ledManager;
+
+    public static LedManagerUtils getInstance(){
+        if (instance == null){
+            synchronized (LedManagerUtils.class){
+                if (instance == null){
+                    instance = new LedManagerUtils();
+                }
+            }
+        }
+        return instance;
+    }
+
+    public void ledInit(Application application) {
+        //灵信C2M
+        ledManager = new LedC2MManager();
+        ledManager.init(application);
+    }
+
+    public void initIp() {
+        if (ledManager != null) {
+            ledManager.initIpList();
+        }
+    }
+
+    public void setLedList(ArrayList<LedItem> list) {
+        if (ledManager != null) {
+            ledManager.setLedIpList(list);
+        }
+    }
+
+    public void updateProgram(String text, int action) {
+        if (ledManager != null) {
+            ledManager.updateProgram(text, action);
+        }
+    }
+
+    public void updateDefaultProgram() {
+        if (ledManager != null) {
+            ledManager.updateDefaultProgram();
+        }
+    }
+
+    public ArrayList<LedItem> getLedList() {
+        if (ledManager != null) {
+            return ledManager.getLedList();
+        }
+        return new ArrayList<>();
+    }
+
+    public void removeAllProgram() {
+        if (ledManager != null) {
+            ledManager.removeAllProgram();
+        }
+    }
+
+    public void syncTime() {
+        if (ledManager != null) {
+            ledManager.syncTime();
+        }
+    }
+
+    public void powerOnOff() {
+        if (ledManager != null) {
+            ledManager.powerOnOff();
+        }
+    }
+
+    public void checkFontFile() {
+        if (ledManager != null) {
+            long size = ledManager.checkLedFont();
+            if (size > 0) {
+                ExtendMethodsKt.showMessage("字库文件存在!文件大小为: " + size);
+            } else {
+                ExtendMethodsKt.showMessage("字库文件不存在,请导入字库文件或尝试重启设备!");
+            }
+        }
+    }
+
+    public void copyFont() {
+        if (ledManager != null) {
+            ledManager.copyFont();
+        }
+    }
+
+    public void release() {
+        if (ledManager != null) {
+            ledManager.release();
+        }
+    }
+}

+ 28 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/led/LedProgram.java

@@ -0,0 +1,28 @@
+package com.wdkl.ncs.android.component.nursehome.led;
+
+public class LedProgram {
+
+    private String text;
+    private long time;
+
+    public LedProgram(String text, long time) {
+        this.text = text;
+        this.time = time;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+}

+ 100 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/service/AppService.kt

@@ -0,0 +1,100 @@
+package com.wdkl.ncs.android.component.nursehome.service
+
+import android.app.Notification
+import android.app.NotificationChannel
+import android.app.NotificationManager
+import android.app.Service
+import android.content.Context
+import android.content.Intent
+import android.os.Binder
+import android.os.Build
+import android.os.IBinder
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import org.greenrobot.eventbus.EventBus
+import serialporttest.utils.SerialPortUtil
+import com.wdkl.ncs.android.middleware.common.SerialType
+
+class AppService : Service(), SerialPortUtil.ISerialPortOnclickEvent, SerialPortUtil.IForkSpringSwiData {
+    private val TAG = AppService::class.java.simpleName
+    internal var myBinder = ServiceBinder()
+
+    private var notificationManager: NotificationManager? = null
+    private var notificationId: String = "channelId-0"
+    private var notificationName: String = "wdkl-host"
+
+    override fun onCreate() {
+        super.onCreate()
+
+        notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager?
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            var channel = NotificationChannel(
+                    notificationId,
+                    notificationName,
+                    NotificationManager.IMPORTANCE_HIGH
+            );
+            notificationManager!!.createNotificationChannel(channel)
+        }
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            startForeground(110, getNotification())//开前台服务
+        }
+
+        setSerialListner()
+        SerialPortUtil.getInstance().powerIndicator(1)
+    }
+
+    private fun getNotification(): Notification {
+        var builder: Notification.Builder = Notification.Builder(this)
+                .setSmallIcon(R.mipmap.ic_launcher)
+                .setContentTitle("维鼎康联")
+                .setContentText("系统服务已启动")
+                .setOnlyAlertOnce(true)
+        //设置Notification的ChannelID,否则不能正常显示
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            builder.setChannelId(notificationId);
+        }
+        var notification: Notification = builder.build();
+        return notification;
+    }
+
+    //设置串口监听
+    private fun setSerialListner() {
+        SerialPortUtil.getInstance().setOnDataReceiveListener(this, this)
+    }
+
+    override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
+        return super.onStartCommand(intent, flags, startId)
+    }
+
+
+    override fun onBind(intent: Intent): IBinder {
+        return myBinder
+    }
+
+    //呼叫键串口消息
+    override fun serialPortBedOnclick(buffer: ByteArray) {
+        EventBus.getDefault().post(MessageEvent(SerialType(0, buffer[0].toInt()), Constants.EVENT_SERIAL_PORT))
+
+    }
+
+    //手柄串口消息
+    override fun forkSpringData(data: Int) {
+        EventBus.getDefault().post(MessageEvent(SerialType(1, data), Constants.EVENT_SERIAL_PORT))
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+        stopForeground(true)// 停止前台服务--参数:表示是否移除之前的通知
+        SerialPortUtil.getInstance().closeHeart()
+        SerialPortUtil.getInstance().closeSerialPort()
+    }
+
+    inner class ServiceBinder : Binder() {
+        fun doThings() {}
+    }
+
+}

+ 215 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/service/RTCKeepLiveService.java.bak

@@ -0,0 +1,215 @@
+package com.wdkl.ncs.android.component.nursehome.service;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.support.annotation.Nullable;
+
+import com.starrtc.demo.utils.AEvent;
+import com.starrtc.demo.utils.IEventListener;
+
+
+/**
+ * Created by zhangjt on 2017/8/6.
+ */
+
+public class RTCKeepLiveService extends Service implements IEventListener {
+    private String TAG = RTCKeepLiveService.class.getSimpleName();
+
+    private String DeviceSipId = "";
+    @Nullable
+    @Override
+    public IBinder onBind(Intent intent) {
+        return null;
+    }
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+    }
+
+    @Override
+    public void onDestroy()
+    {
+        super.onDestroy();
+        removeListener();
+    }
+
+    @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+//        try {
+//            if(intent != null){
+//                DeviceSipId = intent.getStringExtra("DeviceSipId");
+//            }
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+        initSDK();
+        return super.onStartCommand(intent, flags, startId);
+    }
+
+    private void initSDK(){
+//        MLOC.init(this);
+        initFree();
+    }
+
+    private boolean isLogin = false;
+    //开放版SDK初始化
+    private void initFree(){
+//        MLOC.d("RTCKeepLiveService","initFree");
+//        isLogin = XHClient.getInstance().getIsOnline();
+//        Log.e("RTCKeepLiveService","isLogin "+isLogin);
+//        Log.e("RTCKeepLiveService","MLOC.userId  "+MLOC.userId);
+//        if(!isLogin){
+//            if(!MLOC.userId.equals(DeviceSipId)){
+////                MLOC.userId = ""+(new Random().nextInt(900000)+100000);
+////                MLOC.userId = "0000";
+////                MLOC.saveUserId(MLOC.userId);
+//
+//                MLOC.userId = DeviceSipId;
+//                Log.e(TAG,"userId "+DeviceSipId);
+//                MLOC.saveUserId(MLOC.userId);
+//
+//            }
+            addListener();
+
+//            XHCustomConfig customConfig =  XHCustomConfig.getInstance(this);
+//            customConfig.setChatroomServerUrl(MLOC.CHATROOM_SERVER_URL);
+//            customConfig.setLiveSrcServerUrl(MLOC.LIVE_SRC_SERVER_URL);
+//            customConfig.setLiveVdnServerUrl(MLOC.LIVE_VDN_SERVER_URL);
+//            customConfig.setImServerUrl(MLOC.IM_SERVER_URL);
+//            customConfig.setVoipServerUrl(MLOC.VOIP_SERVER_URL);
+//            customConfig.setLogEnable(false); //关闭SDK调试日志
+////            customConfig.setDefConfigOpenGLESEnable(false);
+////            customConfig.setDefConfigCameraId(1);//设置默认摄像头方向  0后置  1前置
+////            customConfig.setDefConfigVideoSize(XHConstants.XHCropTypeEnum.STAR_VIDEO_CONFIG_360BW_640BH_180SW_320SH);
+//            customConfig.setLogDirPath(Environment.getExternalStorageDirectory().getPath()+"/starrtcLog");
+////            customConfig.setDefConfigCamera2Enable(false);
+////            StarCamera.setFrameBufferEnable(false);
+//            customConfig.initSDKForFree(MLOC.userId, new IXHErrorCallback() {
+//                @Override
+//                public void error(final String errMsg, Object data) {
+//                    MLOC.e("RTCKeepLiveService","error:"+errMsg);
+//                    MLOC.showMsg(RTCKeepLiveService.this,errMsg);
+//                }
+//            },new Handler());
+//
+//            XHClient.getInstance().getChatManager().addListener(new XHChatManagerListener());
+//            XHClient.getInstance().getGroupManager().addListener(new XHGroupManagerListener());
+//            XHClient.getInstance().getVoipManager().addListener(new XHVoipManagerListener());
+//            XHClient.getInstance().getVoipP2PManager().addListener(new XHVoipP2PManagerListener());
+//            XHClient.getInstance().getLoginManager().addListener(new XHLoginManagerListener());
+//            XHVideoSourceManager.getInstance().setVideoSourceCallback(new DemoVideoSourceCallback());
+//
+//            XHClient.getInstance().getLoginManager().loginFree(new IXHResultCallback() {
+//                @Override
+//                public void success(Object data) {
+//                    MLOC.d("RTCKeepLiveService","loginSuccess");
+//                    isLogin = true;
+//                }
+//                @Override
+//                public void failed(final String errMsg) {
+//                    MLOC.d("RTCKeepLiveService","loginFailed "+errMsg);
+//                    MLOC.showMsg(RTCKeepLiveService.this,errMsg);
+//                }
+//            });
+//        }
+    }
+
+    @Override
+    public void dispatchEvent(String aEventID, boolean success, Object eventObj) {
+        switch (aEventID){
+            case AEvent.AEVENT_VOIP_REV_CALLING:{
+//                Intent intent = new Intent(this, VoipRingingActivity.class);
+//                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
+//                intent.putExtra("targetId",eventObj.toString());
+//                startActivity(intent);
+            }
+            break;
+            case AEvent.AEVENT_VOIP_REV_CALLING_AUDIO:{
+                //todo 原生startRTC 语音呼入 启动原生的activity
+//                Intent intent = new Intent(this, VoipAudioRingingActivity.class);
+//                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
+//                intent.putExtra("targetId",eventObj.toString());
+//                startActivity(intent);
+                //todo 原生startRTC 语音呼入 启动自己修改的activity
+//                Intent intent = new Intent(this, RTCVoipAudioRingingActivity.class);
+//                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
+//                intent.putExtra("targetId",eventObj.toString());
+//                startActivity(intent);
+//
+//                Log.e("TAG","本地启动。。。");
+
+            }
+            break;
+            case AEvent.AEVENT_VOIP_P2P_REV_CALLING:
+//                if(MLOC.canPickupVoip){
+//                    Intent intent = new Intent(this, VoipP2PRingingActivity.class);
+//                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
+//                    intent.putExtra("targetId",eventObj.toString());
+//                    startActivity(intent);
+//                }
+                break;
+            case AEvent.AEVENT_VOIP_P2P_REV_CALLING_AUDIO:
+//                if(MLOC.canPickupVoip){
+//                    Intent intent = new Intent(this, VoipP2PRingingActivity.class);
+//                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
+//                    intent.putExtra("targetId",eventObj.toString());
+//                    startActivity(intent);
+//                }
+                break;
+            case AEvent.AEVENT_C2C_REV_MSG:
+            case AEvent.AEVENT_REV_SYSTEM_MSG:
+//                MLOC.hasNewC2CMsg = true;
+                break;
+            case AEvent.AEVENT_GROUP_REV_MSG:
+//                MLOC.hasNewGroupMsg = true;
+                break;
+            case AEvent.AEVENT_LOGOUT:
+//                removeListener();
+//                this.stopSelf();
+                break;
+            case AEvent.AEVENT_USER_KICKED:
+            case AEvent.AEVENT_CONN_DEATH:
+//                MLOC.d("RTCKeepLiveService","AEVENT_USER_KICKED OR AEVENT_CONN_DEATH");
+//                XHClient.getInstance().getLoginManager().loginFree(new IXHResultCallback() {
+//                    @Override
+//                    public void success(Object data) {
+//                        MLOC.d("RTCKeepLiveService","loginSuccess");
+//                        isLogin = true;
+//                    }
+//                    @Override
+//                    public void failed(final String errMsg) {
+//                        MLOC.d("RTCKeepLiveService","loginFailed "+errMsg);
+//                        MLOC.showMsg(RTCKeepLiveService.this,errMsg);
+//                    }
+//                });
+                break;
+        }
+    }
+
+    private void addListener(){
+        AEvent.addListener(AEvent.AEVENT_LOGOUT,this);
+        AEvent.addListener(AEvent.AEVENT_VOIP_REV_CALLING,this);
+        AEvent.addListener(AEvent.AEVENT_VOIP_REV_CALLING_AUDIO,this);
+        AEvent.addListener(AEvent.AEVENT_VOIP_P2P_REV_CALLING,this);
+        AEvent.addListener(AEvent.AEVENT_C2C_REV_MSG,this);
+        AEvent.addListener(AEvent.AEVENT_REV_SYSTEM_MSG,this);
+        AEvent.addListener(AEvent.AEVENT_GROUP_REV_MSG,this);
+        AEvent.addListener(AEvent.AEVENT_USER_KICKED,this);
+        AEvent.addListener(AEvent.AEVENT_CONN_DEATH,this);
+    }
+
+    private void removeListener(){
+        AEvent.removeListener(AEvent.AEVENT_LOGOUT,this);
+        AEvent.removeListener(AEvent.AEVENT_VOIP_REV_CALLING,this);
+        AEvent.removeListener(AEvent.AEVENT_VOIP_REV_CALLING_AUDIO,this);
+        AEvent.removeListener(AEvent.AEVENT_VOIP_P2P_REV_CALLING,this);
+        AEvent.removeListener(AEvent.AEVENT_C2C_REV_MSG,this);
+        AEvent.removeListener(AEvent.AEVENT_REV_SYSTEM_MSG,this);
+        AEvent.removeListener(AEvent.AEVENT_GROUP_REV_MSG,this);
+        AEvent.removeListener(AEvent.AEVENT_USER_KICKED,this);
+        AEvent.removeListener(AEvent.AEVENT_CONN_DEATH,this);
+    }
+
+}

+ 761 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/settingconfig/SettingConfig.java

@@ -0,0 +1,761 @@
+package com.wdkl.ncs.android.component.nursehome.settingconfig;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import com.wdkl.ncs.android.component.nursehome.util.SpeechUtil;
+
+
+public class SettingConfig {
+
+
+    private static final String SP_NAME = "SP_FUNCTION";
+
+    //白昼设置白天的初始时间设置
+    private static final String KEY_SP_INITIAL_DAY_TIME = "KEY_SP_INITIAL_DAY_TIME";
+    private static final String initial_day_time = "06:00";
+    private static final String KEY_SP_INITIAL_DAY_TIME_LOCATION = "KEY_SP_INITIAL_DAY_TIME_LOCATION";
+    private static final String initial_day_time_location = "12";
+
+
+    //白昼设置白天的结束时间设置
+    private static final String KEY_SP_END_OF_DAY = "KEY_SP_END_OF_DAY";
+    private static final String end_of_day = "18:30";
+    //白昼设置白天的结束时间设置
+    private static final String KEY_SP_END_OF_DAY_LOCATION = "KEY_SP_END_OF_DAY_LOCATION";
+    private static final String end_of_day_location = "38";
+
+    //播报次数
+    private static final String KEY_SP_CALL_NUMBER = "KEY_SP_CALL_NUMBER";
+    private static final int call_number = 2;
+
+    //主机白天亮度
+    private static final String KEY_SP_MAIN_ENGINE_DAYTIME_BRIGHTNESS = "KEY_SP_MAIN_ENGINE_DAYTIME_BRIGHTNESS";
+    private static final int main_engine_daytime_brightness = 70;
+    //主机晚上亮度
+    private static final String KEY_SP_HOST_NIGHT_BRIGHTNESS = "KEY_SP_HOST_NIGHT_BRIGHTNESS";
+    private static final int host_night_brightness = 50;
+
+    //主机白天系统音量
+    private static final String KEY_SP_HOST_DAYTIME_VOLUME = "KEY_SP_HOST_DAYTIME_VOLUME";
+    private static final int host_daytime_volume = 100;
+    //主机晚上系统音量
+    private static final String KEY_SP_HOST_NIGHT_VOLUME = "KEY_SP_HOST_NIGHT_VOLUME";
+    private static final int host_night_volume = 80;
+
+    //主机免提录入音量
+    private static final String KEY_SP_HANDS_FREE_INPUT_VOLUME_OF_HOST_MACHINE = "KEY_SP_HANDS_FREE_INPUT_VOLUME_OF_HOST_MACHINE";
+    private static final int hands_free_input_volume_of_host_machine = 50;
+    //主机手柄录入音量
+    private static final String KEY_SP_HANDS_FREE_INPUT_VOLUME = "KEY_SP_HANDS_FREE_INPUT_VOLUME";
+    private static final int host_handle_input_volume = 30;
+
+    //主机免提播放音量
+    private static final String KEY_SP_HOST_HANDS_FREE_PLAY_VOLUME = "KEY_SP_HOST_HANDS_FREE_PLAY_VOLUME";
+    private static final int host_hands_free_play_volume = 90;
+    //主机手柄播放音量
+    private static final String KEY_SP_HOST_GAMEPAD_PLAY_VOLUME = "KEY_SP_HOST_GAMEPAD_PLAY_VOLUME";
+    private static final int host_gamepad_play_volume = 40;
+
+    //语音播报模式
+    private static final String KEY_SP_TTS_MODE = "KEY_SP_TTS_MODE";
+    public static final int TTS_OFF = 0;  //音乐
+    public static final int TTS_ON = 1; //tts语音
+
+
+    //通话模式
+    private static final String KEY_SP_TALK_MODE = "KEY_SP_TALK_MODE";
+    public static final int single_pass_mode = 0;  //单工模式
+    public static final int two_way_mode = 1;      //双工模式
+
+    //分机白天亮度
+    private static final String KEY_SP_EXTENSION_DAYTIME_BRIGHTNESS = "KEY_SP_EXTENSION_DAYTIME_BRIGHTNESS";
+    private static final int extension_daytime_brightness = 70;
+    //分机晚上亮度
+    private static final String KEY_SP_EXTENSION_NIGHT_BRIGHTNESS = "KEY_SP_EXTENSION_NIGHT_BRIGHTNESS";
+    private static final int extension_night_brightness = 50;
+
+    //分机LED白天亮度
+    private static final String KEY_SP_EXTENSION_DAYTIME_LED_BRIGHTNESS = "KEY_SP_EXTENSION_DAYTIME_LED_BRIGHTNESS";
+    private static final int extension_daytime_led_brightness = 70;
+    //分机LED晚上亮度
+    private static final String KEY_SP_EXTENSION_NIGHT_LED_BRIGHTNESS = "KEY_SP_EXTENSION_NIGHT_LED_BRIGHTNESS";
+    private static final int extension_night_led_brightness = 50;
+
+    //分机白天系统音量
+    private static final String KEY_SP_EXTENSION_DAYTIME_SYSTEM_VOLUME = "KEY_SP_EXTENSION_DAYTIME_SYSTEM_VOLUME";
+    private static final int extension_daytime_system_volume = 70;
+    //分机晚上系统音量
+    private static final String KEY_SP_EXTENSION_NIGHT_SYSTEM_VOLUME = "KEY_SP_EXTENSION_NIGHT_SYSTEM_VOLUME";
+    private static final int extension_night_system_volume = 50;
+
+    //分机手柄录入音量
+    private static final String KEY_SP_THE_EXTENSION_HANDLR_RECORDS_THE_VOLUME = "KEY_SP_THE_EXTENSION_HANDLR_RECORDS_THE_VOLUME";
+    private static final int the_extension_handle_records_the_volume = 50;
+
+    //分机通话音量
+    private static final String KEY_SP_EXTENSION_CALL_VOLUME = "KEY_SP_EXTENSION_CALL_VOLUME";
+    private static final int extension_call_volume = 70;
+
+
+    //传统转换盒系统音量
+    private static final String KEY_SP_CHANGE_BOX_SYSTEM_VOLUME = "KEY_SP_CHANGE_BOX_SYSTEM_VOLUME";
+    private static final int change_box_system_volume = 70;
+
+
+    //门口机白天亮度
+    private static final String KEY_SP_DOOR_MACHINE_DAYTIME_BRIGHTNESS = "KEY_SP_DOOR_MACHINE_DAYTIME_BRIGHTNESS";
+    private static final int door_machine_daytime_brightness = 70;
+    //门口机晚上亮度
+    private static final String KEY_SP_DOOR_MACHINE_NIGHT_BRIGHTNESS = "KEY_SP_DOOR_MACHINE_NIGHT_BRIGHTNESS";
+    private static final int door_machine_night_brightness = 50;
+
+
+    //门口机通话音量
+    private static final String KEY_SP_DOOR_PHONE_VOLUME = "KEY_SP_DOOR_PHONE_VOLUME";
+    private static final int door_phone_volume = 70;
+
+    //点阵屏相关参数
+    private static final String KEY_SP_LED_PROGRAM_TIME = "KEY_SP_LED_PROGRAM_TIME";
+    private static final String KEY_SP_LED_VOICE_VOLUME = "KEY_SP_LED_VOICE_VOLUME";
+    private static final String KEY_SP_LED_VOICE_TIMES = "KEY_SP_LED_VOICE_TIMES";
+    private static final String KEY_SP_LED_INFO_TYPE = "KEY_SP_LED_INFO_TYPE";
+    private static final String KEY_SP_LED_CUSTOM_INFO = "KEY_SP_LED_CUSTOM_INFO";
+
+    //app上次启动时间
+    private static final String KEY_SP_APP_START_TIME = "KEY_SP_APP_START_TIME";
+
+    //呼叫转移开关
+    private static final String KEY_SP_CALL_TRANSFER = "KEY_SP_CALL_TRANSFER";
+
+    //语音播报模式
+    public static int getTtsMode(Context context) {
+        return getSP(context).getInt(KEY_SP_TTS_MODE, TTS_ON);
+    }
+
+    public static void setTtsMode(Context context, int mode) {
+        getEditor(context).putInt(KEY_SP_TTS_MODE, mode).apply();
+    }
+
+    public static boolean getTransferCall(Context context) {
+        return getSP(context).getBoolean(KEY_SP_CALL_TRANSFER, false);
+    }
+
+    public static void setTransferCall(Context context, boolean on) {
+        getEditor(context).putBoolean(KEY_SP_CALL_TRANSFER, on).apply();
+    }
+
+    /**
+     * 获取播报次数
+     *
+     * @return
+     */
+    public static int getCallNumber(Context context) {
+        return getSP(context).getInt(KEY_SP_CALL_NUMBER, call_number);
+    }
+
+    /**
+     * 设置播报次数
+     *
+     * @param value
+     */
+    public static void setCallNumber(Context context, int value) {
+        if (value > 0) {
+            SpeechUtil.getInstance().setSpeechLoopCount(value);
+        }
+        getEditor(context).putInt(KEY_SP_CALL_NUMBER, value).apply();
+    }
+
+
+    /**
+     * 获取主机白天亮度
+     *
+     * @return
+     */
+    public static int getMainEngineDaytimeBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_MAIN_ENGINE_DAYTIME_BRIGHTNESS, main_engine_daytime_brightness);
+    }
+
+    /**
+     * 设置主机白天亮度
+     *
+     * @param value
+     */
+    public static void setMainEngineDaytimeBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_MAIN_ENGINE_DAYTIME_BRIGHTNESS, value).apply();
+    }
+
+    /**
+     * 获取主机晚上亮度
+     *
+     * @return
+     */
+    public static int getHostNightBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_HOST_NIGHT_BRIGHTNESS, host_night_brightness);
+    }
+
+    /**
+     * 设置主机晚上亮度
+     *
+     * @param value
+     */
+    public static void setHostNightBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_HOST_NIGHT_BRIGHTNESS, value).apply();
+    }
+
+    /**
+     * 获取主机白天系统音量
+     *
+     * @return
+     */
+    public static int getHostDaytimeVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_HOST_DAYTIME_VOLUME, host_daytime_volume);
+    }
+
+    /**
+     * 设置主机白天系统音量
+     *
+     * @param value
+     */
+    public static void setHostDaytimeVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_HOST_DAYTIME_VOLUME, value).apply();
+    }
+
+    /**
+     * 获取主机晚上系统音量
+     *
+     * @return
+     */
+    public static int getHostNightVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_HOST_NIGHT_VOLUME, host_night_volume);
+    }
+
+    /**
+     * 设置主机晚上系统音量
+     *
+     * @param value
+     */
+    public static void setHostNightVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_HOST_NIGHT_VOLUME, value).apply();
+    }
+
+    /**
+     * 获取主机免提录入音量
+     *
+     * @return
+     */
+    public static int getHandsFreeInputVolumeOfHostMachine(Context context) {
+        return getSP(context).getInt(KEY_SP_HANDS_FREE_INPUT_VOLUME_OF_HOST_MACHINE, hands_free_input_volume_of_host_machine);
+    }
+
+    /**
+     * 设置主机免提录入音量
+     *
+     * @param value
+     */
+    public static void setHandsFreeInputVolumeOfHostMachine(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_HANDS_FREE_INPUT_VOLUME_OF_HOST_MACHINE, value).apply();
+    }
+
+    /**
+     * 获取主机手柄录入音量
+     *
+     * @return
+     */
+    public static int getHostHandleInputVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_HANDS_FREE_INPUT_VOLUME, host_handle_input_volume);
+    }
+
+    /**
+     * 设置主机手柄录入音量
+     *
+     * @param value
+     */
+    public static void setHostHandleInputVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_HANDS_FREE_INPUT_VOLUME, value).apply();
+    }
+
+
+    /**
+     * 获取主机免提播放音量
+     *
+     * @return
+     */
+    public static int getHostHandsFreePlayVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_HOST_HANDS_FREE_PLAY_VOLUME, host_hands_free_play_volume);
+    }
+
+    /**
+     * 设置主机免提播放音量
+     *
+     * @param value
+     */
+    public static void setHostHandsFreePlayVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_HOST_HANDS_FREE_PLAY_VOLUME, value).apply();
+    }
+
+    /**
+     * 获取主机手柄播放音量
+     *
+     * @return
+     */
+    public static int getHostGamepadPlayVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_HOST_GAMEPAD_PLAY_VOLUME, host_gamepad_play_volume);
+    }
+
+    /**
+     * 设置主机手柄播放音量
+     *
+     * @param value
+     */
+    public static void setHostGamepadPlayVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_HOST_GAMEPAD_PLAY_VOLUME, value).apply();
+    }
+
+
+    /**
+     * 获取主机通话模式
+     *
+     * @return
+     */
+    public static int getTalkMode(Context context) {
+        return getSP(context).getInt(KEY_SP_TALK_MODE, two_way_mode);
+    }
+
+    /**
+     * 设置主机通话模式
+     *
+     * @param value
+     */
+    public static void setTalkMode(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_TALK_MODE, value).apply();
+    }
+
+    /**
+     * 获取分机白天亮度
+     *
+     * @return
+     */
+    public static int getExtensionDaytimeBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_EXTENSION_DAYTIME_BRIGHTNESS, extension_daytime_brightness);
+    }
+
+    /**
+     * 设置分机白天亮度
+     *
+     * @param value
+     */
+    public static void setExtensionDaytimeBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_EXTENSION_DAYTIME_BRIGHTNESS, value).apply();
+    }
+
+    /**
+     * 获取分机晚上亮度
+     *
+     * @return
+     */
+    public static int getExtensionNightBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_EXTENSION_NIGHT_BRIGHTNESS, extension_night_brightness);
+    }
+
+    /**
+     * 设置分机晚上亮度
+     *
+     * @param value
+     */
+    public static void setExtensionNightBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_EXTENSION_NIGHT_BRIGHTNESS, value).apply();
+    }
+
+    /**
+     * 获取分机LED白天亮度
+     *
+     * @return
+     */
+    public static int getExtensionDaytimeLEDBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_EXTENSION_DAYTIME_LED_BRIGHTNESS, extension_daytime_led_brightness);
+    }
+
+    /**
+     * 设置分机LED白天亮度
+     *
+     * @param value
+     */
+    public static void setExtensionDaytimeLEDBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_EXTENSION_DAYTIME_LED_BRIGHTNESS, value).apply();
+    }
+
+    /**
+     * 获取分机LED晚上亮度
+     *
+     * @return
+     */
+    public static int getExtensionNightLEDBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_EXTENSION_NIGHT_LED_BRIGHTNESS, extension_night_led_brightness);
+    }
+
+    /**
+     * 设置分机LED晚上亮度
+     *
+     * @param value
+     */
+    public static void setExtensionNightLEDBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_EXTENSION_NIGHT_LED_BRIGHTNESS, value).apply();
+    }
+
+
+    /**
+     * 获取分机白天系统音量
+     *
+     * @return
+     */
+    public static int getExtensionDaytimeSystemVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_EXTENSION_DAYTIME_SYSTEM_VOLUME, extension_daytime_system_volume);
+    }
+
+    /**
+     * 设置分机白天系统音量
+     *
+     * @param value
+     */
+    public static void setExtensionDaytimeSystemVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_EXTENSION_DAYTIME_SYSTEM_VOLUME, value).apply();
+    }
+
+    /**
+     * 获取分机晚上系统音量
+     *
+     * @return
+     */
+    public static int getExtensionNightSystemVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_EXTENSION_NIGHT_SYSTEM_VOLUME, extension_night_system_volume);
+    }
+
+    /**
+     * 设置分机晚上系统音量
+     *
+     * @param value
+     */
+    public static void setExtensionNightSystemVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_EXTENSION_NIGHT_SYSTEM_VOLUME, value).apply();
+    }
+
+
+
+    /**
+     * 获取分机手柄录入音量
+     *
+     * @return
+     */
+    public static int getTheExtensionHandleRecordsTheVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_THE_EXTENSION_HANDLR_RECORDS_THE_VOLUME, the_extension_handle_records_the_volume);
+    }
+
+    /**
+     * 设置分机手柄录入音量
+     *
+     * @param value
+     */
+    public static void setTheExtensionHandleRecordsTheVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_THE_EXTENSION_HANDLR_RECORDS_THE_VOLUME, value).apply();
+    }
+
+
+    /**
+     * 获取分机通话音量
+     *
+     * @return
+     */
+    public static int getExtensionCallVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_EXTENSION_CALL_VOLUME, extension_call_volume);
+    }
+
+    /**
+     * 设置分机通话音量
+     *
+     * @param value
+     */
+    public static void setExtensionCallVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_EXTENSION_CALL_VOLUME, value).apply();
+    }
+
+
+
+
+    /**
+     * 获取传统转换盒系统音量
+     *
+     * @return
+     */
+    public static int getChangeBoxSystemVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_CHANGE_BOX_SYSTEM_VOLUME, change_box_system_volume);
+    }
+
+    /**
+     * 设置传统转换盒系统音量
+     *
+     * @param value
+     */
+    public static void setChangeBoxSystemVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_CHANGE_BOX_SYSTEM_VOLUME, value).apply();
+    }
+
+
+
+
+
+
+    /**
+     * 获取门口机白天亮度
+     *
+     * @return
+     */
+    public static int getDoorMachineDaytimeBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_DOOR_MACHINE_DAYTIME_BRIGHTNESS, door_machine_daytime_brightness);
+    }
+
+    /**
+     * 设置门口机白天亮度
+     *
+     * @param value
+     */
+    public static void setDoorMachineDaytimeBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_DOOR_MACHINE_DAYTIME_BRIGHTNESS, value).apply();
+    }
+
+    /**
+     * 获取门口机晚上亮度
+     *
+     * @return
+     */
+    public static int getDoorMachineNightBrightness(Context context) {
+        return getSP(context).getInt(KEY_SP_DOOR_MACHINE_NIGHT_BRIGHTNESS, door_machine_night_brightness);
+    }
+
+    /**
+     * 设置门口机晚上亮度
+     *
+     * @param value
+     */
+    public static void setDoorMachineNightBrightness(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_DOOR_MACHINE_NIGHT_BRIGHTNESS, value).apply();
+    }
+
+
+
+
+    /**
+     * 获取门口机通话音量
+     *
+     * @return
+     */
+    public static int getDoorPhoneVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_DOOR_PHONE_VOLUME, door_phone_volume);
+    }
+
+    /**
+     * 设置门口机通话音量
+     *
+     * @param value
+     */
+    public static void setDoorPhoneVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_DOOR_PHONE_VOLUME, value).apply();
+    }
+
+
+
+    /**
+     * 获取白昼设置白天的初始时间
+     *
+     * @return
+     */
+    public static String getInitialDayTime(Context context) {
+        return getSP(context).getString(KEY_SP_INITIAL_DAY_TIME, initial_day_time);
+    }
+
+    /**
+     * 设置白昼白天的初始时间
+     *
+     * @param value
+     */
+    public static void setInitialDayTime(Context context, String value) {
+        getEditor(context).putString(KEY_SP_INITIAL_DAY_TIME, value).apply();
+    }
+
+    /**
+     * 获取白昼设置白天的初始时间位置
+     *
+     * @return
+     */
+    public static String getInitialDayTimeLocation(Context context) {
+        return getSP(context).getString(KEY_SP_INITIAL_DAY_TIME_LOCATION, initial_day_time_location);
+    }
+
+    /**
+     * 设置白昼白天的初始时间位置
+     *
+     * @param value
+     */
+    public static void setInitialDayTimeLocation(Context context, String value) {
+        getEditor(context).putString(KEY_SP_INITIAL_DAY_TIME_LOCATION, value).apply();
+    }
+
+
+
+    /**
+     * 设置白昼白天的结束时间
+     *
+     * @param value
+     */
+    public static void setEndOfDay(Context context, String value) {
+        getEditor(context).putString(KEY_SP_END_OF_DAY, value).apply();
+    }
+
+    /**
+     * 获取白昼设置白天的结束时间
+     *
+     * @return
+     */
+    public static String getEndOfDay(Context context) {
+        return getSP(context).getString(KEY_SP_END_OF_DAY, end_of_day);
+    }
+
+    /**
+     * 设置白昼白天的结束时间位置
+     *
+     * @param value
+     */
+    public static void setEndOfDayLocation(Context context, String value) {
+        getEditor(context).putString(KEY_SP_END_OF_DAY_LOCATION, value).apply();
+    }
+
+    /**
+     * 获取白昼设置白天的结束时间位置
+     *
+     * @return
+     */
+    public static String getEndOfDayLocation(Context context) {
+        return getSP(context).getString(KEY_SP_END_OF_DAY_LOCATION, end_of_day_location);
+    }
+
+    /**
+     * 获取点阵屏节目显示时间
+     *
+     * @return
+     */
+    public static int getLedProgramTime(Context context) {
+        return getSP(context).getInt(KEY_SP_LED_PROGRAM_TIME, 6);
+    }
+
+    /**
+     * 设置点阵屏节目显示时间
+     *
+     * @param value
+     */
+    public static void setLedProgramTime(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_LED_PROGRAM_TIME, value).apply();
+    }
+
+    /**
+     * 获取点阵屏语音播报音量
+     *
+     * @return
+     */
+    public static int getLedVoiceVolume(Context context) {
+        return getSP(context).getInt(KEY_SP_LED_VOICE_VOLUME, 5);
+    }
+
+    /**
+     * 设置点阵屏语音播报音量
+     *
+     * @param value
+     */
+    public static void setLedVoiceVolume(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_LED_VOICE_VOLUME, value).apply();
+    }
+
+    /**
+     * 获取点阵屏语音播报次数
+     *
+     * @return
+     */
+    public static int getLedVoiceTimes(Context context) {
+        return getSP(context).getInt(KEY_SP_LED_VOICE_TIMES, 3);
+    }
+
+    /**
+     * 设置点阵屏语音播报次数
+     *
+     * @param value
+     */
+    public static void setLedVoiceTimes(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_LED_VOICE_TIMES, value).apply();
+    }
+
+    /**
+     * 获取点阵屏默认显示类型
+     *
+     * @return
+     */
+    public static int getLedInfoType(Context context) {
+        return getSP(context).getInt(KEY_SP_LED_INFO_TYPE, 0);
+    }
+
+    /**
+     * 设置点阵屏默认显示类型
+     *
+     * @param value
+     */
+    public static void setLedInfoType(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_LED_INFO_TYPE, value).apply();
+    }
+
+    /**
+     * 获取点阵屏默认显示内容
+     *
+     * @return
+     */
+    public static String getLedCustomInfo(Context context) {
+        return getSP(context).getString(KEY_SP_LED_CUSTOM_INFO, "");
+    }
+
+    /**
+     * 设置点阵屏默认显示内容
+     *
+     * @param value
+     */
+    public static void setLedCustomInfo(Context context, String value) {
+        getEditor(context).putString(KEY_SP_LED_CUSTOM_INFO, value).apply();
+    }
+
+    /**
+     * 设置App启动时间
+     *
+     * @param value
+     */
+    public static void setAppStartTime(Context context, String value) {
+        getEditor(context).putString(KEY_SP_APP_START_TIME, value).apply();
+    }
+
+    /**
+     * 获取App启动时间
+     *
+     * @return
+     */
+    public static String getAppStartTime(Context context) {
+        return getSP(context).getString(KEY_SP_APP_START_TIME, "Unknow");
+    }
+
+
+
+
+    private static SharedPreferences getSP(Context context) {
+        return context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
+    }
+
+    private static SharedPreferences.Editor getEditor(Context context) {
+        return getSP(context).edit();
+    }
+
+
+}

+ 247 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AnrFcExceptionUtil.java.bak

@@ -0,0 +1,247 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.app.AlarmManager;
+import android.app.Application;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Environment;
+import android.util.Log;
+
+import com.github.anrwatchdog.ANRError;
+import com.github.anrwatchdog.ANRWatchDog;
+import com.wdkl.ncs.android.component.nursehome.activity.RegisterActivity;
+import com.wdkl.ncs.android.component.nursehome.common.Constants;
+import com.wdkl.ncs.android.middleware.api.UrlManager;
+import com.wdkl.ncs.android.middleware.tcp.channel.DeviceChannel;
+import com.wdkl.skywebrtc.CallSession;
+import com.wdkl.skywebrtc.EnumType;
+import com.wdkl.skywebrtc.SkyEngineKit;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TimeZone;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.FormBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+
+/**
+ * Created by dengzhe on 2018/4/2.
+ * //=========================FC&ANR异常处理类=========================//
+ */
+
+public class AnrFcExceptionUtil implements Thread.UncaughtExceptionHandler {
+
+    private static ANRWatchDog mANRWatchDog;
+    private Thread.UncaughtExceptionHandler mDefaultHandler;
+    public static final String TAG = "AnrFcExceptionUtil";
+    private static Application application;
+
+    private static AnrFcExceptionUtil mAnrFcExceptionUtil;
+
+    private OkHttpClient okHttpClient;
+    private UrlManager urlManager = UrlManager.Companion.build();
+
+    /**
+     * 存储异常和参数信息
+     */
+    private Map<String, String> paramsMap = new HashMap<>();
+    /**
+     * 格式化时间
+     */
+    private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
+
+
+    public static AnrFcExceptionUtil getInstance(Application application) {
+        if (mAnrFcExceptionUtil == null) {
+            mAnrFcExceptionUtil = new AnrFcExceptionUtil(application);
+        }
+        return mAnrFcExceptionUtil;
+    }
+
+    private AnrFcExceptionUtil(Application application) {
+        //获取系统默认的UncaughtException处理器
+        mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
+        this.application = application;
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable ex) {
+        if (!handleException(ex) && mDefaultHandler != null) {
+            //如果用户没有处理则让系统默认的异常处理器来处理
+            mDefaultHandler.uncaughtException(thread, ex);
+        } else {
+            try {
+                Thread.sleep(3000);
+            } catch (InterruptedException e) {
+                Log.e(TAG, "error : ", e);
+            }
+
+            restartApp();
+        }
+    }
+
+    private void restartApp() {
+        Constants.Companion.setCALL_STATE(Constants.Companion.getCALL_STANDBY());
+        DeviceChannel.calling = false;
+        CallSession session= SkyEngineKit.Instance().getCurrentSession();
+        if(session!=null&&session.getState()!= EnumType.CallState.Idle){
+            SkyEngineKit.Instance().endCall();
+        }
+
+        //重新启动app
+        Intent mStartActivity = new Intent(application.getApplicationContext(), RegisterActivity.class);
+        mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        int mPendingIntentId = 123456;
+        PendingIntent mPendingIntent = PendingIntent.getActivity(application.getApplicationContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
+        AlarmManager mgr = (AlarmManager) application.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
+        mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1500, mPendingIntent);
+
+        android.os.Process.killProcess(android.os.Process.myPid());
+        System.exit(0);
+    }
+
+    /**
+     * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成.
+     *
+     * @param ex
+     * @return true:如果处理了该异常信息;否则返回false.
+     */
+    private boolean handleException(Throwable ex) {
+        if (ex == null) {
+            return false;
+        }
+
+        saveCrashInfo2File(ex);
+        return true;
+    }
+
+    private void uploadingErrorLog(String class_name, String err_msg, String exception_name, String method_name, String stack_trace) {
+        if(okHttpClient == null){
+            okHttpClient = new OkHttpClient();
+        }
+
+        FormBody.Builder formBody = new FormBody.Builder();
+        formBody.add("class_name",class_name);
+        formBody.add("method_name",method_name);
+        formBody.add("exception_name",exception_name);
+        formBody.add("err_msg",err_msg);
+        formBody.add("stack_trace",stack_trace);
+
+        Request request  = new Request.Builder()
+                .url(urlManager.getBuyer() + "device/error_log")
+                .post(formBody.build())
+                .build();
+
+        okHttpClient.newCall(request).enqueue(new Callback() {
+            @Override
+            public void onFailure(Call call, IOException e) {
+                Log.e(TAG,"错误日志上传失败"+e.getMessage());
+            }
+
+            @Override
+            public void onResponse(Call call, Response response) throws IOException {
+                Log.d(TAG,"错误日志上传成功");
+                String data = response.body().string();
+                Log.d(TAG,"错误日志数据 data "+data);
+            }
+        });
+    }
+
+    /**
+     * 保存错误信息到文件中
+     *
+     * @param ex
+     * @return 返回文件名称
+     */
+    private String saveCrashInfo2File(Throwable ex) {
+        StringBuffer sb = new StringBuffer();
+        for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+            String key = entry.getKey();
+            String value = entry.getValue();
+            sb.append(key + "=" + value + "\n");
+        }
+
+        Writer writer = new StringWriter();
+        PrintWriter printWriter = new PrintWriter(writer);
+        ex.printStackTrace(printWriter);
+        Throwable cause = ex.getCause();
+        while (cause != null) {
+            cause.printStackTrace(printWriter);
+            cause = cause.getCause();
+        }
+        printWriter.close();
+        String result = writer.toString();
+        sb.append(result);
+
+
+        try {
+            long timestamp = System.currentTimeMillis();
+            String time = format.format(new Date());
+            format.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
+            String fileName = "crash-" + time + "-" + timestamp + ".txt";
+            if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+                String path = Environment.getExternalStorageDirectory() + "/crash/";
+                File dir = new File(path);
+                if (!dir.exists()) {
+                    dir.mkdirs();
+                }
+                FileOutputStream fos = new FileOutputStream(path + fileName);
+                fos.write(sb.toString().getBytes());
+                Log.i(TAG, "saveCrashInfo2File: "+sb.toString());
+                fos.close();
+            }
+
+            //上传错误日志
+            uploadingErrorLog(application.getPackageName(), "crash", "crash", "", sb.toString());
+
+            return fileName;
+        } catch (Exception e) {
+            Log.e(TAG, "an error occured while writing file...", e);
+        }
+
+        return null;
+    }
+
+    /**
+     * ===================================================崩溃异常处理===================================================
+     */
+    public void initFCException() {
+        //设置该CrashHandler为程序的默认处理器
+        AnrFcExceptionUtil catchExcep = AnrFcExceptionUtil.getInstance(application);
+        Thread.setDefaultUncaughtExceptionHandler(catchExcep);
+        mANRWatchDog = new ANRWatchDog(10000);
+        mANRWatchDog.setInterruptionListener(new ANRWatchDog.InterruptionListener() {
+            @Override
+            public void onInterrupted(InterruptedException exception) {
+            }
+        }).setIgnoreDebugger(true).setANRListener(new ANRWatchDog.ANRListener() {
+            @Override
+            public void onAppNotResponding(ANRError error) {
+                /*Intent mStartActivity = new Intent(application.getApplicationContext(), Constants.ANR_FC);
+                int mPendingIntentId = 123456;
+                PendingIntent mPendingIntent = PendingIntent.getActivity(application.getApplicationContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
+                AlarmManager mgr = (AlarmManager) application.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
+                mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1500, mPendingIntent);
+                android.os.Process.killProcess(android.os.Process.myPid());*/
+
+                Log.d("anr", "Anr restart app...");
+                //restartApp();
+                AppUpdateHelper.reboot(application);
+            }
+        }).start();
+
+    }
+}

+ 239 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java

@@ -0,0 +1,239 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Environment;
+import android.support.v4.content.FileProvider;
+import android.util.Log;
+
+import com.wdkl.ncs.android.component.nursehome.activity.RegisterActivity;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+public class AppUpdateHelper {
+    private final static String TAG = "AppUpdate";
+
+    /**
+     * 下载的APK文件绝对路径
+     */
+    public static final String FILE_APK_PATH = Environment.getExternalStorageDirectory() + "/CallingHost";
+    /**
+     * 下载的APK文件的文件名
+     */
+    public static final String FILE_APK_NAME = "CallingHost.apk";
+
+    public static void updateApp(Context context, UpdateCallBack callBack) {
+        if (checkApkExit(context)) {
+            Log.d(TAG, "文件存在");
+        } else {
+            Log.d(TAG, "文件不存在");
+            if (callBack != null) {
+                callBack.onFailed();
+            }
+            return;
+        }
+
+        /*if (!checkApkAvailable(context, DownloadUtil.FILE_APK_PATH + "/" + DownloadUtil.FILE_APK_NAME)) {
+            ToastUtil.showToast("apk文件不匹配,升级失败!");
+            return;
+        }*/
+
+        String path = FILE_APK_PATH + "/" + FILE_APK_NAME;
+        //if (installApp(context.getPackageName(), path)) {
+        if (rootSilenceInstall(path)) {
+            Log.d(TAG, "安装成功");
+            if (callBack != null) {
+                callBack.onSuccess();
+            }
+        } else {
+            Log.d(TAG, "安装失败");
+            if (callBack != null) {
+                callBack.onFailed();
+            }
+        }
+
+        /*if (silentInstall(context, path)) {
+            Log.d(TAG, "app 安装成功");
+            if (callBack != null) {
+                callBack.onSuccess();
+            }
+        }*/
+    }
+
+
+    public static void installAPK(Context context) {
+        try {
+            File apkFile = new File(FILE_APK_PATH + "/" + FILE_APK_NAME);
+            if (!apkFile.exists()) {
+                return;
+            }
+
+            Intent intent = new Intent(Intent.ACTION_VIEW);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//安装完成后打开新版本
+            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // 给目标应用一个临时授权
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {//判断版本大于等于7.0
+                //如果SDK版本>=24,即:Build.VERSION.SDK_INT >= 24,使用FileProvider兼容安装apk
+                String packageName = context.getApplicationContext().getPackageName();
+                String authority = new StringBuilder(packageName).append(".fileprovider").toString();
+                Uri apkUri = FileProvider.getUriForFile(context, authority, apkFile);
+                intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
+            } else {
+                intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
+            }
+            context.startActivity(intent);
+        } catch (Exception e) {
+        }
+    }
+
+    private static boolean checkApkExit(Context context) {
+        File file = new File(FILE_APK_PATH + "/" + FILE_APK_NAME);
+        return file.exists();
+    }
+
+    private static boolean checkApkAvailable(Context context, String path) {
+        try {
+            PackageManager pm = context.getPackageManager();
+            PackageInfo info = pm.getPackageArchiveInfo(path, 0);
+            ApplicationInfo applicationInfo = info.applicationInfo;
+            String newPkg = applicationInfo.packageName;
+            String curPkg = context.getPackageName();
+            Log.d(TAG, "new package: " + newPkg + ", cur package: " + curPkg);
+            if (curPkg.equals(newPkg)) {
+                return true;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return false;
+    }
+
+    public static boolean silentInstall(Context context, String apkPath) {
+        PackageManager packageManager = context.getPackageManager();
+        Class pmClz = packageManager.getClass();
+        try {
+            if (Build.VERSION.SDK_INT >= 21) {
+                Log.d(TAG, "apk path: " + apkPath);
+                Class aClass = Class.forName("android.app.PackageInstallObserver");
+                Constructor constructor = aClass.getDeclaredConstructor();
+                constructor.setAccessible(true);
+                Object installObserver = constructor.newInstance();
+                Method method = pmClz.getDeclaredMethod("installPackage", Uri.class, aClass, int.class, String.class);
+                method.setAccessible(true);
+                method.invoke(packageManager, Uri.fromFile(new File(apkPath)), installObserver, 2, null);
+            } else {
+                Method method = pmClz.getDeclaredMethod("installPackage", Uri.class, Class.forName("android.content.pm.IPackageInstallObserver"), int.class, String.class);
+                method.setAccessible(true);
+                method.invoke(packageManager, Uri.fromFile(new File(apkPath)), null, 2, null);
+            }
+            return true;
+        } catch (Exception e) {
+            Log.e(TAG, e.toString());
+        }
+        return false;
+    }
+
+    public static boolean installApp(String packageName, String apkPath) {
+        Process process = null;
+        BufferedReader successResult = null;
+        BufferedReader errorResult = null;
+        StringBuilder successMsg = new StringBuilder();
+        StringBuilder errorMsg = new StringBuilder();
+        Log.e(TAG, "install package: " + packageName + ", apkPath: " + apkPath);
+        try {
+            process = new ProcessBuilder("pm", "install", "-i", packageName, "-r", apkPath).start();
+            successResult = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            errorResult = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+            String s;
+            while ((s = successResult.readLine()) != null) {
+                successMsg.append(s);
+            }
+            while ((s = errorResult.readLine()) != null) {
+                errorMsg.append(s);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (successResult != null) {
+                    successResult.close();
+                }
+                if (errorResult != null) {
+                    errorResult.close();
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            if (process != null) {
+                process.destroy();
+            }
+        }
+        Log.e(TAG, "" + errorMsg.toString());
+        //如果含有“success”认为安装成功
+        return successMsg.toString().equalsIgnoreCase("success");
+    }
+
+    public static boolean rootSilenceInstall(String path) {
+        Process process;
+        PrintWriter printWriter;
+        try {
+            process = Runtime.getRuntime().exec("su");
+            printWriter = new PrintWriter(process.getOutputStream());
+            printWriter.println("pm install -r " + path);
+            printWriter.flush();
+            printWriter.close();
+            int res = process.waitFor();
+            Log.e(TAG, "silent install res: " + res);
+            if (res == 0) {
+                return true;
+            } else {
+                return false;
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "rootSilenceInstall e:" + e.getMessage());
+            return false;
+        }
+    }
+
+    public static void reboot(Context context) {
+        try {
+            Intent intent = new Intent(Intent.ACTION_REBOOT);
+            intent.putExtra("nowait", 1);
+            intent.putExtra("interval", 1);
+            intent.putExtra("window", 0);
+            context.sendBroadcast(intent);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void restartApp(Context context) {
+        //重新启动app
+        Intent mStartActivity = new Intent(context.getApplicationContext(), RegisterActivity.class);
+        mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        int mPendingIntentId = 123456;
+        PendingIntent mPendingIntent = PendingIntent.getActivity(context.getApplicationContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
+        AlarmManager mgr = (AlarmManager) context.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
+        mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1500, mPendingIntent);
+
+        android.os.Process.killProcess(android.os.Process.myPid());
+        System.exit(0);
+    }
+
+    public interface UpdateCallBack {
+        void onFailed();
+        void onSuccess();
+    }
+}

+ 94 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AppUtil.java

@@ -0,0 +1,94 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.app.AlarmManager;
+import android.content.Context;
+import android.text.TextUtils;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Calendar;
+
+public class AppUtil {
+
+    /**
+     * 设置系统时间
+     *
+     * @param time
+     */
+    public static void setSysTime(String time, String timeZone) {
+        try {
+            Process process = Runtime.getRuntime().exec("su");
+            if (null == process) return;
+            DataOutputStream os = new DataOutputStream(process.getOutputStream());
+            //os.writeBytes("setprop persist.sys.timezone Asia/Shanghai\n");
+            os.writeBytes("setprop persist.sys.timezone " + timeZone + "\n");
+            if (android.os.Build.VERSION.SDK_INT >= 24) {//7.1以上的系统
+                String datetime = changeTimeForm(time); //20211213:092314  ------  051315372019.00
+                os.writeBytes("/system/bin/date " + datetime + " set\n");
+            } else {
+                os.writeBytes("/system/bin/date -s " + time + "\n");//【时间格式 yyyyMMdd.HHmmss】"20131023.112800"
+            }
+            os.writeBytes("clock -w\n");
+            os.writeBytes("exit\n");
+            os.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static String changeTimeForm(String t) {
+        if (!TextUtils.isEmpty(t) && t.length() >= 15) {
+            String yyyy = substringByLengh(t, 0, 4);
+            String MMdd = substringByLengh(t, 4, 8);
+            String HHmm = substringByLengh(t, 9, 13);
+            String ss = substringByLengh(t, 13, 15);
+
+            return MMdd + HHmm + yyyy + "." + ss;
+        } else {
+            return "051315372019.00";
+        }
+    }
+
+    /**
+     * 字符串按索引截取
+     *
+     * @param str
+     * @return
+     */
+    public static String substringByLengh(String str, int start, int end) {
+        if (str == null) {
+            return "";
+        }
+        if (start > end) {
+            return "";
+        }
+        if (str.length() - 1 < start || str.length() < end) {
+            return "";
+        }
+
+        return str.substring(start, end);
+    }
+
+
+    public static void setSystemTime(Context context, int year, int month, int day, int hour, int minute, int mill) {
+        Calendar c = Calendar.getInstance();
+        c.set(Calendar.YEAR, year);
+        c.set(Calendar.MONTH, month);
+        c.set(Calendar.DAY_OF_MONTH, day);
+        c.set(Calendar.HOUR_OF_DAY, hour);
+        c.set(Calendar.MINUTE, minute);
+        c.set(Calendar.SECOND, mill);
+        c.set(Calendar.MILLISECOND, 0);
+        long when = c.getTimeInMillis();
+        if (when / 1000 < Integer.MAX_VALUE) {
+            ((AlarmManager) context.getSystemService(Context.ALARM_SERVICE)).setTime(when);
+        }
+    }
+
+    public static void setSystemTime(Context context, long timeMills, String timeZone) {
+        AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+        //alarmManager.setTimeZone("Asia/Shanghai");
+        alarmManager.setTimeZone(timeZone);
+        alarmManager.setTime(timeMills);
+    }
+}

+ 199 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/AsyncPlayer.java

@@ -0,0 +1,199 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.content.Context;
+import android.media.AudioDeviceInfo;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.net.Uri;
+import android.os.PowerManager;
+import android.os.SystemClock;
+import android.util.Log;
+
+import java.io.IOException;
+import java.util.LinkedList;
+
+/**
+ * 响铃相关类
+ */
+public class AsyncPlayer {
+    private static final int PLAY = 1;
+    private static final int STOP = 2;
+    private AudioManager audioManager;
+
+    private static final class Command {
+        int code;
+        Context context;
+        int resId;
+        boolean looping;
+        int stream;
+        long requestTime;
+
+        public String toString() {
+            return "{ code=" + code + " looping=" + looping + " stream=" + stream + " resId=" + resId + " }";
+        }
+    }
+
+    private final LinkedList mCmdQueue = new LinkedList();
+
+    private void startSound(Command cmd) {
+
+        try {
+            //MediaPlayer player = new MediaPlayer();
+            MediaPlayer player = MediaPlayer.create(cmd.context, cmd.resId);
+            player.setAudioStreamType(cmd.stream);
+            //player.setDataSource(cmd.context, cmd.uri);
+            player.setLooping(cmd.looping);
+            player.setVolume(1.0f, 1.0f);
+            //player.prepare();
+            player.start();
+            player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+                @Override
+                public void onCompletion(MediaPlayer mp) {
+                    mState = STOP;
+                }
+            });
+            if (mPlayer != null) {
+                mPlayer.release();
+            }
+            mPlayer = player;
+            Log.w(mTag, "start sound " + cmd.resId);
+        } catch (Exception e) {
+            Log.w(mTag, "error loading sound for " + cmd.resId, e);
+        }
+    }
+
+    private final class Thread extends java.lang.Thread {
+        Thread() {
+            super("AsyncPlayer-" + mTag);
+        }
+
+        public void run() {
+            while (true) {
+                Command cmd = null;
+
+                synchronized (mCmdQueue) {
+
+                    cmd = (Command) mCmdQueue.removeFirst();
+                }
+
+                switch (cmd.code) {
+                    case PLAY:
+                        startSound(cmd);
+                        break;
+                    case STOP:
+
+                        if (mPlayer != null) {
+                            mPlayer.stop();
+                            mPlayer.reset();
+                            mPlayer.release();
+                            mPlayer = null;
+                        } else {
+                            Log.w(mTag, "STOP command without a player");
+                        }
+                        break;
+                }
+
+                synchronized (mCmdQueue) {
+                    if (mCmdQueue.size() == 0) {
+
+                        mThread = null;
+                        releaseWakeLock();
+                        return;
+                    }
+                }
+            }
+        }
+    }
+
+    private String mTag;
+    private Thread mThread;
+    private MediaPlayer mPlayer;
+    private PowerManager.WakeLock mWakeLock;
+
+    private int mState = STOP;
+
+    public AsyncPlayer(String tag) {
+        if (tag != null) {
+            mTag = tag;
+        } else {
+            mTag = "AsyncPlayer";
+        }
+    }
+
+    public void play(Context context, int res, boolean looping, int stream) {
+        Command cmd = new Command();
+        cmd.requestTime = SystemClock.uptimeMillis();
+        cmd.code = PLAY;
+        cmd.context = context;
+        cmd.resId = res;
+        cmd.looping = looping;
+        cmd.stream = stream;
+        synchronized (mCmdQueue) {
+            enqueueLocked(cmd);
+            mState = PLAY;
+        }
+    }
+
+    public void stop() {
+        synchronized (mCmdQueue) {
+            if (mState != STOP) {
+                Command cmd = new Command();
+                cmd.requestTime = SystemClock.uptimeMillis();
+                cmd.code = STOP;
+                enqueueLocked(cmd);
+                mState = STOP;
+            }
+        }
+    }
+
+    public boolean isPlay() {
+        return mState == PLAY;
+    }
+
+    private void enqueueLocked(Command cmd) {
+        mCmdQueue.add(cmd);
+        if (mThread == null) {
+            acquireWakeLock();
+            mThread = new Thread();
+            mThread.start();
+        }
+    }
+
+    public void setUsesWakeLock(Context context) {
+        if (mWakeLock != null || mThread != null) {
+            throw new RuntimeException("assertion failed mWakeLock=" + mWakeLock + " mThread=" + mThread);
+        }
+        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+        mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mTag);
+    }
+
+    private void acquireWakeLock() {
+        if (mWakeLock != null) {
+            mWakeLock.acquire();
+        }
+    }
+
+    private void releaseWakeLock() {
+        if (mWakeLock != null) {
+            mWakeLock.release();
+        }
+    }
+
+    private boolean isHeadphonesPlugged(Context context) {
+        if (audioManager == null) {
+            audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        }
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
+            AudioDeviceInfo[] audioDevices = audioManager.getDevices(AudioManager.GET_DEVICES_ALL);
+            for (AudioDeviceInfo deviceInfo : audioDevices) {
+                if (deviceInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADPHONES
+                        || deviceInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET) {
+                    return true;
+                }
+            }
+            return false;
+        } else {
+            return audioManager.isWiredHeadsetOn();
+        }
+    }
+}

+ 92 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/CallDialogHelper.java

@@ -0,0 +1,92 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.media.AudioManager;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.wdkl.ncs.android.component.nursehome.R;
+
+
+public class CallDialogHelper {
+
+    private static AlertDialog callDialog;
+
+    public static void showCallDialog(Activity activity, int callType, String callText, View.OnClickListener hangupCall, View.OnClickListener acceptCall, View.OnClickListener rejectCall) {
+        View contentView = LayoutInflater.from(activity).inflate(R.layout.call_dialog_lay, null);
+        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+        builder.setView(contentView);
+
+        LinearLayout outCall = contentView.findViewById(R.id.ll_call_outgoing);
+        ImageView hangup = contentView.findViewById(R.id.iv_hangup_call);
+
+        RelativeLayout inCall = contentView.findViewById(R.id.rl_call_incoming);
+        ImageView accept = contentView.findViewById(R.id.iv_accept_call);
+        ImageView reject = contentView.findViewById(R.id.iv_reject_call);
+        TextView inText = contentView.findViewById(R.id.tv_incoming_call_text);
+        TextView outText = contentView.findViewById(R.id.tv_out_call_text);
+
+        if (callType == 0) {
+            //去电
+            outCall.setVisibility(View.VISIBLE);
+            inCall.setVisibility(View.GONE);
+            outText.setText(callText);
+            RingPlayHelper.playRingTone(activity, R.raw.ring_back2, true);
+        } else {
+            //来电
+            outCall.setVisibility(View.GONE);
+            inCall.setVisibility(View.VISIBLE);
+            inText.setText(callText);
+            /*if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_OFF) {
+                RingPlayHelper.playRingTone(activity, R.raw.incoming_call, false);
+            }*/
+        }
+
+        hangup.setOnClickListener(hangupCall);
+        accept.setOnClickListener(acceptCall);
+        reject.setOnClickListener(rejectCall);
+
+        callDialog = builder.create();
+        callDialog.setCanceledOnTouchOutside(false);
+        callDialog.setCancelable(false);
+
+        //设置dialog宽高及位置
+        try {
+            Window window = callDialog.getWindow();
+            window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
+            callDialog.show();
+            WindowManager.LayoutParams lp = window.getAttributes();
+            lp.width = 600;
+            lp.height = 320;
+            lp.gravity = Gravity.CENTER;
+            //lp.alpha = 0.8f;//设置透明度
+            window.setAttributes(lp);
+
+            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                    | View.SYSTEM_UI_FLAG_FULLSCREEN);
+            window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void dismissCallDialog() {
+        if (callDialog != null && callDialog.isShowing()) {
+            callDialog.dismiss();
+            RingPlayHelper.stopRingTone();
+            SpeechUtil.getInstance().stopSpeak();
+        }
+    }
+}

+ 14 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/EthernetWifiCallBack.java

@@ -0,0 +1,14 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+/**
+ * ======================以太网和wifi状态接口=====================
+ * Created by dengzhe on 2018/2/7.
+ */
+
+public interface EthernetWifiCallBack {
+
+    boolean ethernetStatus(boolean status);//以太网状态
+
+    boolean wifiStatus(boolean status);//wifi状态
+
+}

+ 190 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/HttpHelper.java

@@ -0,0 +1,190 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.util.Log;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+import static com.wdkl.ncs.android.component.nursehome.util.AppUpdateHelper.FILE_APK_NAME;
+import static com.wdkl.ncs.android.component.nursehome.util.AppUpdateHelper.FILE_APK_PATH;
+
+public class HttpHelper {
+    private final static String TAG = "HttpHelper";
+    private static OkHttpClient okHttpClient = null;
+
+    /**
+     * @param url   服务器地址
+     * @param file  所要上传的文件
+     */
+    public static void upload(String url, File file, Object tag, final UploadCallback callback) {
+        if (okHttpClient == null) {
+            okHttpClient = new OkHttpClient();
+        }
+
+        RequestBody requestBody = new MultipartBody.Builder()
+                .setType(MultipartBody.FORM)
+                .addFormDataPart("file", file.getName(), RequestBody.create(MediaType.parse("multipart/form-data"), file))
+                .build();
+
+        Request request = new Request.Builder()
+                .url(url)
+                .tag(tag)
+                .post(requestBody)
+                .build();
+
+        okHttpClient.newCall(request).enqueue(new Callback() {
+            @Override
+            public void onFailure(Call call, IOException e) {
+                if (callback != null) {
+                    callback.onFail();
+                }
+            }
+
+            @Override
+            public void onResponse(Call call, Response response) throws IOException {
+                Log.d(TAG, "upload file response: " + response.toString());
+               if( response.code()==200 && response.body() != null) {
+                   String data = response.body().string();
+                   //voice msg response: upload/file/202104102037715.mp3
+                   if (callback != null) {
+                       callback.onSuccess(data);
+                   }
+               } else {
+                   if (callback != null) {
+                       callback.onFail();
+                   }
+               }
+            }
+        });
+    }
+
+    public static void download(String url, Object tag, final DownloadListener listener) {
+        if (okHttpClient == null) {
+            okHttpClient = new OkHttpClient();
+        }
+
+        Request request = new Request.Builder()
+                .url(url)
+                .tag(tag)
+                .build();
+
+        okHttpClient.newCall(request).enqueue(new Callback() {
+            @Override
+            public void onFailure(Call call, IOException e) {
+                Log.d("download", "onFailure==" + e.toString());
+                if (listener != null) {
+                    listener.onDownloadFailed(); // 下载失败
+                }
+            }
+
+            @Override
+            public void onResponse(Call call, Response response) {
+                Log.d("download", "response==" + response.body().contentLength());
+                InputStream is = null;
+                byte[] buf = new byte[2048];
+                int len;
+                FileOutputStream fos = null;
+                try {
+                    is = response.body().byteStream();
+                    long total = response.body().contentLength();
+                    File file = new File(isHaveExistDir(new File(FILE_APK_PATH), new File(FILE_APK_PATH + "/" + FILE_APK_NAME)), FILE_APK_NAME);
+                    fos = new FileOutputStream(file);
+                    long sum = 0;
+                    while ((len = is.read(buf)) != -1) {
+                        fos.write(buf, 0, len);
+                        sum = sum + (long) len;
+                        //int progress = (int) (sum * 1.0f / total * 100);
+                        float sp = (float) sum / (float) total;
+                        int progress = (int) (sp * 100);
+                        Log.d("download", "progress==" + progress);
+                        if (listener != null) {
+                            listener.onDownloading(progress);// 下载中
+                        }
+                    }
+                    fos.flush();
+                    if (listener != null) {
+                        listener.onDownloadSuccess(); // 下载完成
+                    }
+                } catch (Exception e) {
+                    Log.d("download", "Exception==");
+                    if (listener != null) {
+                        listener.onDownloadFailed();
+                    }
+                } finally {
+                    try {
+                        if (is != null)
+                            is.close();
+                        if (fos != null)
+                            fos.close();
+                    } catch (IOException e) {
+                        Log.d("download", "IOException==");
+                    }
+                }
+            }
+        });
+    }
+
+    public static void cancelRequestByTag(Object tag) {
+        if (okHttpClient != null && tag != null) {
+            for (Call call : okHttpClient.dispatcher().queuedCalls()) {
+                if (tag.equals(call.request().tag())) {
+                    call.cancel();
+                }
+            }
+
+            for (Call call : okHttpClient.dispatcher().runningCalls()) {
+                if (tag.equals(call.request().tag())) {
+                    call.cancel();
+                }
+            }
+        }
+    }
+
+    private static String isHaveExistDir(File downloadFile, File sonFile) throws IOException {
+        Log.d("download", "downloadFile.mkdirs()==" + downloadFile.mkdirs());
+        Log.d("download", "sonFile.mkdir()==" + sonFile.mkdir());
+        if (!downloadFile.mkdirs()) {
+            downloadFile.createNewFile();
+        }
+        deleteAPKFile(sonFile);//只要文件名相同就可以自动替换(按道理此处不需要了,但为了保险起见还是先执行删除操作)。
+        return downloadFile.getAbsolutePath();
+    }
+
+    public static boolean deleteAPKFile(File downloadFile) {
+        return downloadFile.delete();
+    }
+
+
+    public interface UploadCallback{
+        void onFail();
+        void onSuccess(String data);
+    }
+
+    public interface DownloadListener {
+        /**
+         * 下载成功
+         */
+        void onDownloadSuccess();
+
+        /**
+         * @param progress 下载进度
+         */
+        void onDownloading(int progress);
+
+        /**
+         * 下载失败
+         */
+        void onDownloadFailed();
+    }
+}

+ 91 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/LedHelper.java

@@ -0,0 +1,91 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.util.Log;
+
+import com.wdkl.ncs.android.component.nursehome.common.Constants;
+import com.wdkl.ncs.android.component.nursehome.led.LedManagerUtils;
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO;
+import com.wdkl.ncs.android.middleware.tcp.enums.DeviceTypeEnum;
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType;
+import com.wdkl.ncs.android.middleware.utils.CommonUtils;
+
+public class LedHelper {
+
+    public static void updateLedInfo(InteractionVO interactionVO, boolean isAdd, boolean emergency) {
+        //总控主机不控制点阵屏,直接返回
+        if (true) {
+            return;
+        }
+
+        //没有点阵屏设备,直接返回
+        if (!Constants.Companion.getLED_EXIST()) {
+            return;
+        }
+
+        if (interactionVO.getActionType().equals(TcpType.REINFORCE.name())) {
+            String frameName = CommonUtils.subStringBefore(interactionVO.getFromFrameFullName(), "-");
+            if (isAdd) {
+                //新增led节目
+                LedManagerUtils.getInstance().updateProgram(frameName + "请求增援", 1);
+            } else {
+                //删除led节目
+                LedManagerUtils.getInstance().updateProgram(frameName + "请求增援", 2);
+            }
+            return;
+        }
+
+        if (interactionVO.getFromDeviceType() == DeviceTypeEnum.DIGIT_BED_DEVICE.value()
+                || interactionVO.getFromDeviceType() == DeviceTypeEnum.SIMULATE_BED_DEVICE.value()) {
+            //如果交互记录中的fromdevice是分机,有可能是数字分机发送过来的紧急呼叫,需要特别处理
+            if (emergency) {
+                String frameName = CommonUtils.subStringBefore(interactionVO.getFromFrameFullName(), "-");
+                if (isAdd) {
+                    //新增led节目
+                    LedManagerUtils.getInstance().updateProgram(frameName + "紧急呼叫", 1);
+                } else {
+                    //删除led节目
+                    LedManagerUtils.getInstance().updateProgram(frameName + "紧急呼叫", 2);
+                }
+            } else {
+                String frameName = interactionVO.getFromFrameFullName().replace("-", "");
+                if (isAdd) {
+                    //新增led节目
+                    LedManagerUtils.getInstance().updateProgram(frameName + "呼叫", 1);
+                } else {
+                    //删除led节目
+                    LedManagerUtils.getInstance().updateProgram(frameName + "呼叫", 2);
+                }
+            }
+        } else if (interactionVO.getFromDeviceType() == DeviceTypeEnum.EMERGENCY_BUTTON.value()
+                || interactionVO.getFromDeviceType() == DeviceTypeEnum.SIMULATE_EMERGENCY_BUTTON.value()) {
+            //紧急呼叫
+            //String frameName = CommonUtils.subStringBefore(interactionVO.getFromFrameFullName(), "-");
+            String frameName = interactionVO.getFromDeviceName();
+            if (isAdd) {
+                //新增led节目
+                LedManagerUtils.getInstance().updateProgram(frameName + "紧急呼叫", 1);
+            } else {
+                //删除led节目
+                LedManagerUtils.getInstance().updateProgram(frameName + "紧急呼叫", 2);
+            }
+        }
+    }
+
+    public static void cancelLedInfo(InteractionVO interactionVO) {
+        //总控主机不控制点阵屏,直接返回
+        if (true) {
+            return;
+        }
+
+        //没有点阵屏设备,直接返回
+        if (!Constants.Companion.getLED_EXIST()) {
+            return;
+        }
+
+        if (interactionVO.getToDeviceType() == DeviceTypeEnum.DIGIT_BED_DEVICE.value()
+                || interactionVO.getToDeviceType() == DeviceTypeEnum.SIMULATE_BED_DEVICE.value()) {
+            String frameName = interactionVO.getToFrameFullName().replace("-", "");
+            LedManagerUtils.getInstance().updateProgram(frameName + "呼叫", 2);
+        }
+    }
+}

+ 225 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/MediaPlayHelper.java

@@ -0,0 +1,225 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Message;
+
+import com.wdkl.ncs.android.lib.base.BaseApplication;
+
+public class MediaPlayHelper {
+
+    private static MediaPlayHelper sInstance = null;
+    private MediaPlayer mediaPlayer;
+    private HandlerThread playHandlerThread;
+    private Handler playHandler;
+
+    private int mResId;
+    private String mUrl;
+    private float mVolume;
+    private boolean mLoop;
+
+    /**
+     * 播放res资源
+     */
+    public static final int PLAY_RES = 100;
+    /**
+     * 播放url资源
+     */
+    public static final int PLAY_URL = 101;
+    /**
+     * 停止
+     */
+    public static final int STOP = 102;
+    /**
+     * 释放
+     */
+    public static final int RELEASE = 103;
+
+
+    private MediaPlayHelper() {
+        createHandlerThread();
+    }
+
+    public static MediaPlayHelper getInstance() {
+        if (sInstance == null) {
+            synchronized (MediaPlayHelper.class) {
+                if (sInstance == null) {
+                    sInstance = new MediaPlayHelper();
+                }
+            }
+        }
+        return sInstance;
+    }
+
+    private void createHandlerThread() {
+        if (playHandlerThread == null) {
+            playHandlerThread = new HandlerThread("playHandlerThread");
+            playHandlerThread.start();
+        }
+
+        if (playHandler == null) {
+            playHandler = new Handler(playHandlerThread.getLooper()) {
+                @Override
+                public void handleMessage(Message msg) {
+                    switch (msg.what) {
+                        case PLAY_RES:
+                            playResMusicNow();
+                            break;
+                        case PLAY_URL:
+                            playUrlMusicNow();
+                            break;
+                        case STOP:
+                            stopMusicNow();
+                            break;
+                        case RELEASE:
+                            releaseMediaNow();
+                            break;
+                        default:
+                            break;
+                    }
+                }
+            };
+        }
+    }
+
+    public void playResMusic(int id, float vol, boolean loop) {
+        mResId = id;
+        mVolume = vol;
+        mLoop = loop;
+        playHandler.sendEmptyMessage(PLAY_RES);
+    }
+
+    public void playUrlMusic(String url, float vol, boolean loop) {
+        mUrl = url;
+        mVolume = vol;
+        mLoop = loop;
+        playHandler.sendEmptyMessage(PLAY_URL);
+    }
+
+    public void stopMusic() {
+        playHandler.sendEmptyMessage(STOP);
+    }
+
+    public void releaseMusic() {
+        playHandler.sendEmptyMessage(RELEASE);
+    }
+
+    //播放本地res音频资源
+    private void playResMusicNow() {
+        if (mediaPlayer != null) {
+            mediaPlayer.stop();
+            mediaPlayer.reset();
+            mediaPlayer.release();
+        }
+        mediaPlayer = MediaPlayer.create(BaseApplication.appContext, mResId);
+        try {
+            mediaPlayer.setLooping(mLoop);
+            mediaPlayer.setVolume(mVolume, mVolume);
+            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+            mediaPlayer.start();
+            mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+                @Override
+                public void onCompletion(MediaPlayer player) {
+                    //playMusicComplete();
+                    //stopMusicNow();
+                }
+            });
+            mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
+                @Override
+                public boolean onError(MediaPlayer player, int what, int extra) {
+                    //playMusicError();
+                    stopMusicNow();
+                    return false;
+                }
+            });
+        } catch (Exception e) {
+            //playMusicError();
+            e.printStackTrace();
+        }
+    }
+
+    //播放远程或本地存储音频资源
+    private void playUrlMusicNow() {
+        if (mediaPlayer != null) {
+            mediaPlayer.stop();
+            mediaPlayer.reset();
+            mediaPlayer.release();
+        }
+        mediaPlayer = new MediaPlayer();
+        try {
+            mediaPlayer.reset();
+            mediaPlayer.setDataSource(mUrl);
+            mediaPlayer.setLooping(mLoop);
+            mediaPlayer.setVolume(mVolume, mVolume);
+            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+            mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+                @Override
+                public void onPrepared(MediaPlayer player) {
+                    if (mediaPlayer != null) {
+                        mediaPlayer.start();
+                    }
+                }
+            });
+            mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+                @Override
+                public void onCompletion(MediaPlayer player) {
+                    //playMusicComplete();
+                    //stopMusicNow();
+                }
+            });
+            mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
+                @Override
+                public boolean onError(MediaPlayer player, int what, int extra) {
+                    //playMusicError();
+                    stopMusicNow();
+                    return false;
+                }
+            });
+            mediaPlayer.prepareAsync();
+        } catch (Exception e) {
+            //playMusicError();
+            e.printStackTrace();
+        }
+    }
+
+    private void stopMusicNow() {
+        if (mediaPlayer != null) {
+            mediaPlayer.setOnPreparedListener(null);
+            mediaPlayer.setOnCompletionListener(null);
+            try {
+                //if (mediaPlayer.isPlaying()) {
+                    mediaPlayer.stop();
+                    mediaPlayer.reset();
+                    mediaPlayer.release();
+                //}
+            } catch (IllegalStateException e) {
+                e.printStackTrace();
+            }
+        }
+        mediaPlayer = null;
+    }
+
+    private void releaseMediaNow() {
+        if (mediaPlayer != null) {
+            mediaPlayer.setOnPreparedListener(null);
+            mediaPlayer.setOnCompletionListener(null);
+            try {
+                mediaPlayer.stop();
+                mediaPlayer.reset();
+                mediaPlayer.release();
+            } catch (IllegalStateException e) {
+                e.printStackTrace();
+            }
+        }
+        mediaPlayer = null;
+    }
+
+    public boolean isMediaPlaying() {
+        if (mediaPlayer != null) {
+            return mediaPlayer.isPlaying();
+        }
+        return false;
+    }
+}

+ 587 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/NetHelper.java

@@ -0,0 +1,587 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.bluetooth.BluetoothAdapter;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.net.ConnectivityManager;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.os.Build;
+import android.provider.Settings;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+
+import com.wdkl.ncs.android.lib.base.BaseApplication;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+
+public class NetHelper {
+    private WifiManager wifiManager;
+    private ConnectivityManager connManager;
+    private static NetHelper sInstance = null;
+
+    private static Timer timerNetStatus = null;
+    private static final int SCHEDULE_TIME = 30000;
+    public static boolean NetConn = false;
+
+    /**
+     * 以太网是否ping成功
+     */
+    public static final String ETHERNETSTATUS = "ethernetStatus";
+
+    public NetHelper() {
+    }
+
+    public static NetHelper getInstance() {
+        if (sInstance == null) {
+            synchronized (NetHelper.class) {
+                if (sInstance == null) {
+                    sInstance = new NetHelper();
+                }
+            }
+        }
+        return sInstance;
+    }
+
+    public void init() {
+        wifiManager = (WifiManager) BaseApplication.appContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
+        connManager = (ConnectivityManager) BaseApplication.appContext.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
+    }
+
+    public static void startNetCheck() {
+        if (timerNetStatus != null) {
+            timerNetStatus.purge();
+        }
+        timerNetStatus = new Timer();
+        timerNetStatus.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                NetConn = ping(getLocalElement(3), 2, null);
+
+//                EventBus.getDefault().post(new MessageEvent(ETHERNETSTATUS, EVENT_INTERNETPING));//循环检测SIP,以太网ping状态
+            }
+        }, 10, SCHEDULE_TIME);
+    }
+
+    /**
+     * ping 网络
+     *
+     * @param host
+     * @param pingCount
+     * @param stringBuffer
+     * @return
+     */
+    public static boolean ping(String host, int pingCount, StringBuffer stringBuffer) {
+        String line = null;
+        Process process = null;
+        BufferedReader successReader = null;
+        String command = "ping -c " + pingCount + " " + host;
+        boolean isSuccess = false;
+        try {
+            process = Runtime.getRuntime().exec(command);
+            if (process == null) {
+                append(stringBuffer, "ping fail:process is null.");
+                return false;
+            }
+            successReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            while ((line = successReader.readLine()) != null) {
+                append(stringBuffer, line);
+            }
+            int status = process.waitFor();
+            if (status == 0) {
+                append(stringBuffer, "exec cmd success:" + command);
+                isSuccess = true;
+            } else {
+                append(stringBuffer, "exec cmd fail.");
+                isSuccess = false;
+            }
+            append(stringBuffer, "exec finished.");
+        } catch (IOException e) {
+        } catch (InterruptedException e) {
+        } finally {
+            if (process != null) {
+                process.destroy();
+            }
+            if (successReader != null) {
+                try {
+                    successReader.close();
+                } catch (IOException e) {
+                }
+            }
+        }
+
+        return isSuccess;
+    }
+
+    private static void append(StringBuffer stringBuffer, String text) {
+        if (stringBuffer != null) {
+            stringBuffer.append(text + "\n");
+        }
+    }
+
+    /**
+     * 获取网关  Waderson
+     * <p>
+     * 1 WIFI情况下获取网关 2 有线网络下的DHCP模式连接 3 有线网络其他连接方式:比如静态ip、pppoe拨号、ipoe拨号等
+     */
+    public static String getLocalElement(int type) {
+        String e = "";
+        if (1 == type) {
+            //e = getLocalElementByWifi();
+        } else if (2 == type) {
+            e = getLocalElementByDhcp();
+        } else if (3 == type) {
+            e = getLocalElementByIp();
+        }
+        if (!TextUtils.isEmpty(e) && e.length() >= 11 && e.length() <= 15) {
+            return e;
+        } else {
+            return "192.168.101.1";
+        }
+    }
+
+
+    /**
+     * 有线网络下的DHCP模式连接
+     */
+    public static String getLocalElementByDhcp() {
+        BufferedReader bufferedReader = null;
+        String str2 = "";
+        String str3 = "getprop dhcp.eth0.gateway";
+        Process exec;
+        BufferedReader bufferedReader2 = null;
+        try {
+            exec = Runtime.getRuntime().exec(str3);
+            try {
+                bufferedReader2 = new BufferedReader(new InputStreamReader(exec.getInputStream()));
+            } catch (Throwable th3) {
+                if (bufferedReader != null) {
+                    bufferedReader.close();
+                }
+                if (exec != null) {
+                    exec.exitValue();
+                }
+            }
+            try {
+                str3 = bufferedReader2.readLine();
+                if (str3 != null) {
+                    TextUtils.isEmpty(str3);
+                }
+                try {
+                    bufferedReader2.close();
+                } catch (IOException iOException222) {
+                    iOException222.printStackTrace();
+                }
+                if (exec != null) {
+                    try {
+                        exec.exitValue();
+                    } catch (Exception e5) {
+                    }
+                }
+            } catch (IOException e6) {
+                str3 = str2;
+                if (bufferedReader2 != null) {
+                    bufferedReader2.close();
+                }
+                if (exec != null) {
+                    exec.exitValue();
+                }
+                return str3;
+            }
+        } catch (IOException e62) {
+            bufferedReader2 = null;
+            exec = null;
+            str3 = str2;
+            if (bufferedReader2 != null) {
+                try {
+                    bufferedReader2.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (exec != null) {
+                exec.exitValue();
+            }
+            return str3;
+        } catch (Throwable th4) {
+            exec = null;
+            if (bufferedReader != null) {
+                try {
+                    bufferedReader.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (exec != null) {
+                exec.exitValue();
+            }
+        }
+        return str3;
+    }
+
+    /**
+     * 有线网络其他连接方式:比如静态ip、pppoe拨号、ipoe拨号等
+     */
+    public static String getLocalElementByIp() {
+        BufferedReader bufferedReader = null;
+        String result = "";
+        String str2 = "";
+        String str3 = "ip route list table 0";
+        Process exec;
+        BufferedReader bufferedReader2 = null;
+        try {
+            exec = Runtime.getRuntime().exec(str3);
+            try {
+                bufferedReader2 = new BufferedReader(new InputStreamReader(exec.getInputStream()));
+            } catch (Throwable th3) {
+                if (bufferedReader != null) {
+                    bufferedReader.close();
+                }
+                if (exec != null) {
+                    exec.exitValue();
+                }
+            }
+            try {
+                str2 = bufferedReader2.readLine();
+                if (str2 != null) {
+                    str2 = str2.trim();
+                    String[] strings = str2.split("\\s+");
+                    if (strings.length > 3) {
+                        result = strings[2];
+                    }
+                }
+                try {
+                    bufferedReader2.close();
+                } catch (IOException iOException222) {
+                    iOException222.printStackTrace();
+                }
+                if (exec != null) {
+                    try {
+                        exec.exitValue();
+                    } catch (Exception e5) {
+                    }
+                }
+            } catch (IOException e6) {
+                if (bufferedReader2 != null) {
+                    bufferedReader2.close();
+                }
+                if (exec != null) {
+                    exec.exitValue();
+                }
+                return result;
+            }
+        } catch (IOException e62) {
+            bufferedReader2 = null;
+            exec = null;
+            if (bufferedReader2 != null) {
+                try {
+                    bufferedReader2.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (exec != null) {
+                exec.exitValue();
+            }
+            return result;
+        } catch (Throwable th4) {
+            exec = null;
+            if (bufferedReader != null) {
+                try {
+                    bufferedReader.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (exec != null) {
+                exec.exitValue();
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 得到MAC
+     *
+     * @return String
+     */
+    public String getMacAddress() {
+
+        if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.O || Build.MODEL.equals("rk3368")){//小于安卓8 走这里
+            String mac = "";
+            try {
+                mac = getLocalMacAddressFromIp();
+                if (TextUtils.isEmpty(mac)) {
+                    mac = getNetworkMac();
+                }
+                if (TextUtils.isEmpty(mac)) {
+                    mac = tryGetWifiMac();
+                }
+            } catch (Exception e) {
+            }
+            return mac;
+        }else {//大于安卓8走这里
+            List<NetworkInterface> interfaces = null;
+            try {
+                interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
+                for (NetworkInterface networkInterface : interfaces) {
+                    if (networkInterface != null && TextUtils.isEmpty(networkInterface.getName()) == false) {
+                        if ("wlan0".equalsIgnoreCase(networkInterface.getName())) {
+                            byte[] macBytes = networkInterface.getHardwareAddress();
+                            if (macBytes != null && macBytes.length > 0) {
+                                StringBuilder str = new StringBuilder();
+                                for (byte b : macBytes) {
+                                    str.append(String.format("%02X:", b));
+                                }
+                                if (str.length() > 0) {
+                                    str.deleteCharAt(str.length() - 1);
+                                }
+                                return str.toString();
+                            }
+                        }
+                    }
+                }
+            } catch (SocketException e) {
+                e.printStackTrace();
+            }
+            return "unknown";
+
+        }
+    }
+
+    /**
+     * 兼容安卓5-10 获取Mac地址
+     * @return
+     */
+    public String getMacAddress2() {
+        List<NetworkInterface> interfaces = null;
+        try {
+            interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
+            for (NetworkInterface networkInterface : interfaces) {
+                if (networkInterface != null && TextUtils.isEmpty(networkInterface.getName()) == false) {
+                    if ("wlan0".equalsIgnoreCase(networkInterface.getName())) {
+                        byte[] macBytes = networkInterface.getHardwareAddress();
+                        if (macBytes != null && macBytes.length > 0) {
+                            StringBuilder str = new StringBuilder();
+                            for (byte b : macBytes) {
+                                str.append(String.format("%02X:", b));
+                            }
+                            if (str.length() > 0) {
+                                str.deleteCharAt(str.length() - 1);
+                            }
+                            return str.toString();
+                        }
+                    }
+                }
+            }
+        } catch (SocketException e) {
+            e.printStackTrace();
+        }
+        return "unknown";
+    }
+
+
+    /**
+     * 通过WiFiManager获取mac地址
+     * 这个方法Android 7.0是获取不到的,返回的是null,其实是返回“02:00:00:00:00:00”
+     *
+     * @return
+     */
+    public String tryGetWifiMac() {
+        String mac;
+        WifiInfo wi = wifiManager.getConnectionInfo();
+        if (wi == null || wi.getMacAddress() == null) {
+            mac = null;
+        }
+        if ("02:00:00:00:00:00".equals(wi.getMacAddress().trim())) {
+            mac = null;
+        } else {
+            mac = wi.getMacAddress().trim();
+        }
+        return mac;
+    }
+
+    /**
+     * 通过网络接口获取
+     *
+     * @return
+     */
+    public static String getNetworkMac() {
+        try {
+            List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
+            for (NetworkInterface nif : all) {
+                // if (!nif.getName().equalsIgnoreCase("wlan0") && !nif.getName().equalsIgnoreCase("eth0") && !nif.getName().equalsIgnoreCase("eth1"))
+                if (!nif.getName().equalsIgnoreCase("eth0") && !nif.getName().equalsIgnoreCase("eth1") && !nif.getName().equalsIgnoreCase("eth2"))
+                    continue;
+                byte[] macBytes = nif.getHardwareAddress();
+                if (macBytes == null) {
+                    return null;
+                }
+                StringBuilder res1 = new StringBuilder();
+                for (byte b : macBytes) {
+                    res1.append(String.format("%02X:", b));
+                }
+                if (res1.length() > 0) {
+                    res1.deleteCharAt(res1.length() - 1);
+                }
+                return res1.toString();
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return null;
+    }
+
+
+    /**
+     * 根据IP地址获取MAC地址
+     *
+     * @return
+     */
+    @SuppressLint("NewApi")
+    public static String getLocalMacAddressFromIp() {
+        String strMacAddr = null;
+        try {
+            // 获得IpD地址
+            InetAddress ip = getLocalInetAddress();
+            byte[] b = NetworkInterface.getByInetAddress(ip)
+                    .getHardwareAddress();
+            StringBuffer buffer = new StringBuffer();
+            for (int i = 0; i < b.length; i++) {
+                if (i != 0) {
+                    buffer.append(':');
+                }
+                String str = Integer.toHexString(b[i] & 0xFF);
+                buffer.append(str.length() == 1 ? 0 + str : str);
+            }
+            strMacAddr = buffer.toString().toUpperCase();
+
+        } catch (Exception e) {
+
+        }
+
+        return strMacAddr;
+    }
+
+    /**
+     * 获取移动设备本地IP
+     *
+     * @return
+     */
+    public static InetAddress getLocalInetAddress() {
+        InetAddress ip = null;
+        try {
+            // 列举
+            Enumeration<NetworkInterface> en_netInterface = NetworkInterface
+                    .getNetworkInterfaces();
+            while (en_netInterface.hasMoreElements()) {// 是否还有元素
+                NetworkInterface ni = (NetworkInterface) en_netInterface
+                        .nextElement();// 得到下一个元素
+                Enumeration<InetAddress> en_ip = ni.getInetAddresses();// 得到一个ip地址的列举
+                while (en_ip.hasMoreElements()) {
+                    ip = en_ip.nextElement();
+                    if (!ip.isLoopbackAddress()
+                            && ip.getHostAddress().indexOf(":") == -1)
+                        break;
+                    else
+                        ip = null;
+                }
+
+                if (ip != null) {
+                    break;
+                }
+            }
+        } catch (SocketException e) {
+
+            e.printStackTrace();
+        }
+        return ip;
+    }
+
+    //获取本地ip地址
+    public String getLocalIP() {
+        try {
+            for (Enumeration<NetworkInterface> enNetI = NetworkInterface.getNetworkInterfaces(); enNetI.hasMoreElements(); ) {
+                NetworkInterface netI = enNetI.nextElement();
+                for (Enumeration<InetAddress> enumIpAddr = netI.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
+                    InetAddress inetAddress = enumIpAddr.nextElement();
+                    if (inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) {
+                        return inetAddress.getHostAddress();
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public String getIMEI() {
+        //获取序列号
+        String serial = null;
+        try {
+            serial = android.os.Build.SERIAL;
+            if (serial.equalsIgnoreCase("unknown")||serial.equalsIgnoreCase("0123456789abcdef")) {
+                final TelephonyManager mTelephony = (TelephonyManager) BaseApplication.appContext.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                    if (BaseApplication.appContext.getApplicationContext().checkSelfPermission(Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
+                        serial = null;
+                    }
+                }
+                assert mTelephony != null;
+                if (mTelephony.getDeviceId() != null) {
+                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                        serial = mTelephony.getImei();
+                    } else {
+                        serial = mTelephony.getDeviceId();
+                    }
+                } else {
+                    serial = Settings.Secure.getString(BaseApplication.appContext.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
+                }
+
+            }
+        } catch (Exception e) {
+
+        }
+        return serial;
+    }
+
+    public static boolean isBTConnected() {
+        BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
+        if (btAdapter != null) {
+            return btAdapter.getState() == BluetoothAdapter.STATE_ON;
+        }
+
+        return false;
+    }
+
+    public int getNetworkType() {
+        if (connManager != null && connManager.getActiveNetworkInfo() != null) {
+            return connManager.getActiveNetworkInfo().getType();
+        }
+
+        return -1;
+    }
+
+    public boolean networkAvailable() {
+        if (connManager != null && connManager.getActiveNetworkInfo() != null) {
+            return connManager.getActiveNetworkInfo().isConnected();
+        }
+
+        return false;
+    }
+}

+ 39 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/RingPlayHelper.java

@@ -0,0 +1,39 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.content.Context;
+import android.media.AudioManager;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+
+public class RingPlayHelper {
+
+    private static AsyncPlayer ringPlayer;
+    private final static Handler handler = new Handler(Looper.getMainLooper()) {
+        @Override
+        public void handleMessage(Message msg) {
+            if (ringPlayer != null) {
+                ringPlayer.stop();
+            }
+        }
+    };
+
+    public static void playRingTone(Context context, int res, boolean loop) {
+        if (ringPlayer == null) {
+            ringPlayer = new AsyncPlayer(null);
+        }
+
+        if (!ringPlayer.isPlay()) {
+            ringPlayer.play(context, res, loop, AudioManager.STREAM_MUSIC);
+            handler.removeCallbacksAndMessages(null);
+            handler.sendEmptyMessageDelayed(10, 30000);
+        }
+    }
+
+    public static void stopRingTone() {
+        handler.removeCallbacksAndMessages(null);
+        if (ringPlayer != null) {
+            ringPlayer.stop();
+        }
+    }
+}

+ 81 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/ScreenManagerUtil.kt

@@ -0,0 +1,81 @@
+package com.wdkl.ncs.android.component.nursehome.util
+
+import android.content.Context
+import android.content.Intent
+import android.net.Uri
+import android.os.Build
+import android.provider.Settings
+import android.util.Log
+
+class ScreenManagerUtil {
+
+
+    /**
+     * @return 0--255
+     */
+    fun getScreenBrightness(context: Context): Int {
+        var screenBrightness = 150
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            if (!Settings.System.canWrite(context)) {
+                val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
+                intent.data = Uri.parse("package:" + context.packageName)
+                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                context.startActivity(intent)
+            } else {
+                //有了权限,具体的动作
+                try {
+                    screenBrightness = Settings.System.getInt(context.contentResolver,
+                            Settings.System.SCREEN_BRIGHTNESS)
+                } catch (e: Settings.SettingNotFoundException) {
+                    e.printStackTrace()
+                }
+
+            }
+        } else {
+            try {
+                screenBrightness = Settings.System.getInt(context.contentResolver,
+                        Settings.System.SCREEN_BRIGHTNESS)
+            } catch (e: Settings.SettingNotFoundException) {
+                e.printStackTrace()
+            }
+
+        }
+
+        return screenBrightness
+    }
+
+
+    /**
+     * 保存当前的屏幕亮度值,并使之生效
+     *
+     * @param paramInt 0-255
+     */
+    fun setScreenBrightness(context: Context, paramInt: Int) {
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            if (!Settings.System.canWrite(context)) {
+                val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
+                intent.data = Uri.parse("package:" + context.packageName)
+                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                context.startActivity(intent)
+            } else {
+                //有了权限,具体的动作
+                Settings.System.putInt(context.contentResolver,
+                        Settings.System.SCREEN_BRIGHTNESS, paramInt)
+                val uri = Settings.System
+                        .getUriFor("screen_brightness")
+                Log.w("当前亮度", "当前亮度======" + getScreenBrightness(context))
+                context.contentResolver.notifyChange(uri, null)
+            }
+        } else {
+            Settings.System.putInt(context.contentResolver,
+                    Settings.System.SCREEN_BRIGHTNESS, paramInt)
+            val uri = Settings.System
+                    .getUriFor("screen_brightness")
+            Log.w("当前亮度", "当前亮度======" + getScreenBrightness(context))
+            context.contentResolver.notifyChange(uri, null)
+        }
+
+    }
+}

+ 159 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/ServerConfigDialogHelper.java

@@ -0,0 +1,159 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.AdapterView;
+import android.widget.EditText;
+import android.widget.GridView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.wdkl.ncs.android.component.nursehome.R;
+import com.wdkl.ncs.android.component.nursehome.adapter.NumAdapter;
+import com.wdkl.ncs.android.lib.base.BaseApplication;
+import com.wdkl.ncs.android.lib.utils.ExtendMethodsKt;
+import com.wdkl.ncs.android.middleware.utils.CommonUtils;
+
+
+public class ServerConfigDialogHelper {
+
+    private static AlertDialog callDialog;
+    private static String pwd = "";
+
+    public static void showPasswordDialog(final Activity activity) {
+        View contentView = LayoutInflater.from(activity).inflate(R.layout.server_config_dialog_lay, null);
+        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+        builder.setView(contentView);
+
+        final String[] numbers = {"1","2","3","4","5","6","7","8","9"};
+        final TextView password = contentView.findViewById(R.id.tv_psw_view);
+        final LinearLayout llPwd = contentView.findViewById(R.id.ll_password);
+        final LinearLayout llServer = contentView.findViewById(R.id.ll_server_config);
+        GridView gridView = contentView.findViewById(R.id.grid_psw);
+        NumAdapter adapter = new NumAdapter(numbers, activity);
+        gridView.setAdapter(adapter);
+        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                if (pwd.length() <= 2) {
+                    pwd = pwd + numbers[position];
+                    password.setText(pwd);
+                }
+                Log.d("serverIp", "input password len: " + pwd.length() + "--" + pwd);
+            }
+        });
+
+        TextView delete = contentView.findViewById(R.id.btn_delete);
+        TextView cancel = contentView.findViewById(R.id.btn_cancel);
+        TextView confirm = contentView.findViewById(R.id.btn_confirm);
+        delete.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Log.d("serverIp", "delete password len: " + pwd.length() + "--" + pwd);
+                if (pwd.length() > 1) {
+                    pwd = pwd.substring(0, pwd.length()-1);
+                    password.setText(pwd);
+                } else {
+                    pwd = "";
+                    password.setText(pwd);
+                    password.setHint("请输入密码");
+                }
+            }
+        });
+
+        cancel.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dismissCallDialog();
+            }
+        });
+
+        confirm.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if ("666".equals(pwd)) {
+                    llPwd.setVisibility(View.GONE);
+                    llServer.setVisibility(View.VISIBLE);
+                } else {
+                    Toast.makeText(activity, "密码错误", Toast.LENGTH_SHORT).show();
+                }
+            }
+        });
+
+        final EditText editUrl = contentView.findViewById(R.id.edit_url);
+        final EditText editPort = contentView.findViewById(R.id.edit_port);
+        final EditText editSipUrl = contentView.findViewById(R.id.edit_sip_url);
+        final EditText editSipPort = contentView.findViewById(R.id.edit_sip_port);
+        TextView saveConfig = contentView.findViewById(R.id.btn_save_config);
+        TextView cancelConfig = contentView.findViewById(R.id.btn_cancel_config);
+        editUrl.setText(CommonUtils.getUrl(BaseApplication.appContext));
+        editPort.setText(CommonUtils.getUrlPort(BaseApplication.appContext));
+        //editSipUrl.setText(CommonUtils.getSipUrl(BaseApplication.appContext));
+        //editSipPort.setText(CommonUtils.getSipPort(BaseApplication.appContext));
+        saveConfig.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                String url = editUrl.getText().toString();
+                String port = editPort.getText().toString();
+                if (TextUtils.isEmpty(url) || TextUtils.isEmpty(port)) {
+                    ExtendMethodsKt.showMessage("参数不能为空");
+                } else {
+                    //保存配置
+                    CommonUtils.setUrl(BaseApplication.appContext, url);
+                    CommonUtils.setUrlPort(BaseApplication.appContext, port);
+                    //CommonUtils.setSipUrl(BaseApplication.appContext, editSipUrl.getText().toString());
+                    //CommonUtils.setSipPort(BaseApplication.appContext, editSipPort.getText().toString());
+                    dismissCallDialog();
+                }
+            }
+        });
+        cancelConfig.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dismissCallDialog();
+            }
+        });
+
+
+        callDialog = builder.create();
+        callDialog.setCanceledOnTouchOutside(false);
+        callDialog.setCancelable(false);
+        callDialog.show();
+
+        //设置dialog宽高及位置
+        try {
+            Window window = callDialog.getWindow();
+            window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
+            WindowManager.LayoutParams lp = window.getAttributes();
+            lp.width = 400;
+            lp.height = 480;
+            lp.gravity = Gravity.CENTER;
+            window.setAttributes(lp);
+
+            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                    | View.SYSTEM_UI_FLAG_FULLSCREEN);
+            window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void dismissCallDialog() {
+        pwd = "";
+        if (callDialog != null && callDialog.isShowing()) {
+            callDialog.dismiss();
+        }
+    }
+}

+ 202 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/SpeechUtil.java

@@ -0,0 +1,202 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.content.Context;
+import android.speech.tts.TextToSpeech;
+import android.speech.tts.UtteranceProgressListener;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.wdkl.ncs.android.component.nursehome.common.Constants;
+
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+public class SpeechUtil {
+    private static final String TAG = "SpeechUtil";
+
+    private TextToSpeech textToSpeech;
+    private static SpeechUtil speech;
+    private int speakIndex = 0;
+    private int loopCount = 2;
+    private boolean isStop = true;
+    public volatile static ArrayList<String> speechTextList = new ArrayList<>();
+    private Thread speechThread;
+    private boolean isSpeechLoop = true;
+    private String speakSpeech;
+    private final Object lockObject = new Object();
+
+    public static SpeechUtil getInstance() {
+        if (speech == null) {
+            synchronized (SpeechUtil.class) {
+                if (speech == null) {
+                    speech = new SpeechUtil();
+                }
+            }
+        }
+        return speech;
+    }
+
+    public void init(Context context, final TtsCallback callback) {
+        textToSpeech = new TextToSpeech(context, new TextToSpeech.OnInitListener() {
+            @Override
+            public void onInit(int status) {
+                if (status == TextToSpeech.SUCCESS) {
+                    int supported = textToSpeech.setLanguage(Locale.CHINESE);
+                    if ((supported != TextToSpeech.LANG_AVAILABLE) && (supported != TextToSpeech.LANG_COUNTRY_AVAILABLE)) {
+                        Constants.Companion.setTTS_STATUS(1);
+                        Log.d(TAG, "onInit: 当前不支持中文");
+                        if (callback != null) {
+                            callback.onInit(false);
+                        }
+                    } else {
+                        Constants.Companion.setTTS_STATUS(2);
+                        Log.d(TAG, "onInit: 支持中文");
+                        if (callback != null) {
+                            callback.onInit(true);
+                        }
+                    }
+                    Log.d(TAG, "onInit: TTS引擎初始化成功");
+                } else {
+                    Constants.Companion.setTTS_STATUS(0);
+                    Log.d(TAG, "onInit: TTS引擎初始化失败");
+                    if (callback != null) {
+                        callback.onInit(false);
+                    }
+                }
+            }
+        }, "com.iflytek.speechcloud");
+        textToSpeech.setSpeechRate(0.5f);
+
+    }
+
+    public void addSpeech(String text, boolean emergency) {
+        synchronized (lockObject) {
+            Log.d(TAG, "start add text speech: " + text);
+
+            if (speechTextList.contains(text)) {
+                return;
+            }
+            Log.d(TAG, "truely add text speech: " + text);
+
+            if (emergency) {
+                stopSpeak();
+                speechTextList.add(0, text);
+            } else {
+                speechTextList.add(text);
+            }
+            startSpeechThread();
+        }
+    }
+
+    public synchronized void speak(final String text) {
+        Log.d(TAG, "tts speak: " + text);
+
+        isStop = false;
+        textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null, "uniqueId");
+        textToSpeech.setOnUtteranceProgressListener(new UtteranceProgressListener() {
+            @Override
+            public void onStart(String utteranceId) {
+                //LogUtil.d(TAG, "speak onStart..." + utteranceId);
+            }
+
+            @Override
+            public void onDone(String utteranceId) {
+                speakIndex++;
+                //LogUtil.d(TAG, "speak onDone...index: " + speakIndex + ", loop: " + loopCount);
+                if (speakIndex < loopCount) {
+                    //循环播报
+                    speak(text);
+                } else {
+                    //语音播报完毕
+                    speakIndex = 0;
+                    isStop = true;
+                }
+            }
+
+            @Override
+            public void onError(String utteranceId) {
+                isStop = true;
+                Log.d(TAG, "speak onError..." + utteranceId);
+            }
+        });
+    }
+
+    public void stopSpeak() {
+        speechTextList.clear();
+        if (textToSpeech != null && textToSpeech.isSpeaking()) {
+            textToSpeech.stop();
+            isStop = true;
+            speakIndex = 0;
+
+            Log.d(TAG, "stop speak");
+        }
+    }
+
+    public void removeSpeak(String text) {
+        synchronized (lockObject) {
+            if (!TextUtils.isEmpty(text) && !TextUtils.isEmpty(speakSpeech)) {
+                Log.d(TAG, "remove speak: " + text);
+
+                if (text.equals(speakSpeech) && textToSpeech.isSpeaking()) {
+                    textToSpeech.stop();
+                    speechTextList.remove(text);
+                    isStop = true;
+                    speakIndex = 0;
+                } else {
+                    speechTextList.remove(text);
+                }
+            }
+        }
+    }
+
+    public void setSpeechLoopCount(int count) {
+        loopCount = count;
+    }
+
+    public void release() {
+        speechTextList.clear();
+        isStop = true;
+        speakIndex = 0;
+        if (textToSpeech != null) {
+            textToSpeech.stop();
+            textToSpeech.shutdown();
+            textToSpeech = null;
+        }
+    }
+
+    public void startSpeechThread() {
+        if (null == speechThread) {
+            speechThread = new Thread(new SpeechRunnable());
+            speechThread.start();
+        } else if (!speechThread.isAlive()) {
+            speechThread.start();
+        }
+    }
+
+    public class SpeechRunnable implements Runnable {
+        public void run() {
+            while (isSpeechLoop) {
+                if (speechTextList.size() > 0 && isStop) {
+                    speakSpeech = speechTextList.get(0);
+                    Log.d(TAG, "speakSpeech: " + speakSpeech);
+
+                    speak(speakSpeech);
+
+                    speechTextList.remove(speakSpeech);
+                }
+
+                try {
+                    Thread.sleep(50);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+
+    public interface TtsCallback {
+        void onInit(boolean success);
+    }
+}

+ 87 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/TimeTransition.kt

@@ -0,0 +1,87 @@
+package com.wdkl.ncs.android.component.nursehome.util
+
+import java.text.ParseException
+import java.text.SimpleDateFormat
+import java.util.*
+
+
+object TimeTransition {
+
+    fun stampToDate(s:Long):String{
+//        return TimeStampToTime(s,"yyyy-MM-dd HH:mm:ss")
+        return getDateTime(s,"yyyy-MM-dd")
+    }
+
+    /**
+     * 时间戳转时间 不带时区
+     */
+    fun stampToTime(s:Long):String{
+        return TimeStampToTime(s,"HH:mm:ss")
+    }
+
+    fun stampToDateTime(s:Long):String{
+        return TimeStampToTime(s,"MM-dd HH:mm")
+    }
+
+    /**
+     * 时间戳转时间 不带时区
+     */
+    fun TimeStampToTime(s:Long, timestamp:String):String{
+        val res: String
+        val simpleDateFormat = SimpleDateFormat(timestamp)
+        val lt = s
+        val date = Date(lt)
+        res = simpleDateFormat.format(date)
+        return res
+}
+
+    /**
+     * 获取当前的时间 带时区
+     */
+    fun getDateTime(format: String): String {
+        val date = Date(System.currentTimeMillis())
+        val sdf = SimpleDateFormat(format)
+        //sdf.timeZone = TimeZone.getTimeZone("GMT+8")
+        return sdf.format(date)
+    }
+
+    /**
+     * 时间戳转时间字符串
+     */
+    fun getDateTime(timeMillis: Long, format: String): String {
+        if (timeMillis > 0) {
+            val date = Date(timeMillis)
+            val sdf = SimpleDateFormat(format)
+            //sdf.timeZone = TimeZone.getTimeZone("GMT+8")
+            return sdf.format(date)
+        }
+        return "null"
+    }
+
+    /**
+     * 时间转时间戳
+     */
+    fun dateToStamp(s: String): Long {
+        return dateToStamp(s, "yyyy-MM-dd HH:mm:ss")
+    }
+
+    /**
+     * 将时间转换为时间戳
+     */
+    fun dateToStamp(s: String, pattern: String): Long {
+        val simpleDateFormat = SimpleDateFormat(pattern)
+        var date: Date? = null
+        try {
+            //simpleDateFormat.timeZone = TimeZone.getTimeZone("GMT+8")
+            date = simpleDateFormat.parse(s)
+
+            return date!!.time
+        } catch (e: ParseException) {
+            e.printStackTrace()
+        }
+
+        return 0
+    }
+
+
+}

+ 194 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/VoiceManagerUtil.java

@@ -0,0 +1,194 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.content.Context;
+import android.media.AudioManager;
+
+/**
+ * 类名称:VoiceManagerUtil <br>
+ * 类描述:声音控制工具类 <br>
+ * 创建人:Waderson Shll (TEL:15675117662)<br>
+ * 创建时间:2018-03-15 <br>
+ * 特别提醒:如有需要该类可任意创建与调用;在未通知本人的情况下该类禁止任何修改!<br>
+ */
+public class VoiceManagerUtil {
+    /**
+     * 获取提示音音量最大值
+     *
+     * @param context
+     */
+    public static int getAlarmMax(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM);
+    }
+
+    /**
+     * 获取提示音音量当前值
+     *
+     * @param context
+     */
+    public static int getAlarmNow(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamVolume(AudioManager.STREAM_ALARM);
+    }
+
+    /**
+     * 获取多媒体音量最大值
+     *
+     * @param context
+     */
+    public static int getMusicMax(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
+    }
+
+    /**
+     * 获取多媒体音量当前值
+     *
+     * @param context
+     */
+    public static int getMusicNow(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
+    }
+
+    /**
+     * 获取铃声音量最大值
+     *
+     * @param context
+     */
+    public static int getRingMax(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
+    }
+
+    /**
+     * 获取铃声音量当前值
+     *
+     * @param context
+     */
+    public static int getRingNow(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamVolume(AudioManager.STREAM_RING);
+    }
+
+    /**
+     * 获取系统音量最大值
+     *
+     * @param context
+     */
+    public static int getSystemMax(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_SYSTEM);
+    }
+
+    /**
+     * 获取系统音量当前值
+     *
+     * @param context
+     */
+    public static int getSystemNow(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamVolume(AudioManager.STREAM_SYSTEM);
+    }
+
+    /**
+     * 获取通话音量最大值
+     *
+     * @param context
+     */
+    public static int getCallMax(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);
+    }
+
+    /**
+     * 获取通话音量当前值
+     *
+     * @param context
+     */
+    public static int getCallNow(Context context) {
+        AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        return mAudioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
+    }
+
+    /**
+     * 设置提示音音量
+     *
+     * @param context
+     * @param percent (百分比;只能0--100之间)
+     */
+    public static void setAlarmVoice(Context context, int percent) {
+        float vPercent=((float)percent)/100f;
+        vPercent = vPercent < 0 ? 0 : vPercent;
+        vPercent = vPercent > 1 ? 1 : vPercent;
+        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        audioManager.setStreamVolume(AudioManager.STREAM_ALARM, (int) (getAlarmMax(context) * vPercent), 0);
+    }
+
+    /**
+     * 设置多媒体音量
+     *
+     * @param context
+     * @param percent (百分比;只能0--100之间)
+     */
+    public static void setMusicVoice(Context context, int percent) {
+        float vPercent=((float)percent)/100f;
+        vPercent = vPercent < 0 ? 0 : vPercent;
+        vPercent = vPercent > 1 ? 1 : vPercent;
+        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, (int) (getMusicMax(context) * vPercent), 0);
+    }
+
+    /**
+     * 设置铃声音量
+     *
+     * @param context
+     * @param percent (百分比;只能0--100之间)
+     */
+    public static void setRingVoice(Context context, int percent) {
+        float vPercent=((float)percent)/100f;
+        vPercent = vPercent < 0 ? 0 : vPercent;
+        vPercent = vPercent > 1 ? 1 : vPercent;
+        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        audioManager.setStreamVolume(AudioManager.STREAM_RING, (int) (getRingMax(context) * vPercent), 0);
+    }
+
+    /**
+     * 设置系统音量
+     *
+     * @param context
+     * @param percent (百分比;只能0--100之间)
+     */
+    public static void setSystemVoice(Context context, int percent) {
+        float vPercent=((float)percent)/100f;
+        vPercent = vPercent < 0 ? 0 : vPercent;
+        vPercent = vPercent > 1 ? 1 : vPercent;
+        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, (int) (getSystemMax(context) * vPercent), 0);
+    }
+
+    /**
+     * 设置通话音量
+     *
+     * @param context
+     * @param percent (百分比;只能0--100之间)
+     */
+    public static void setCallVoice(Context context, int percent) {
+        float vPercent=((float)percent)/100f;
+        vPercent = vPercent < 0 ? 0 : vPercent;
+        vPercent = vPercent > 1 ? 1 : vPercent;
+        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, (int) (getCallMax(context) * vPercent), 0);
+    }
+
+    public static void switchAudioMode(Context context, boolean speakerOn) {
+        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+        audioManager.setSpeakerphoneOn(speakerOn);
+        if (speakerOn) {
+            audioManager.setMode(AudioManager.MODE_NORMAL);
+        } else {
+            audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
+        }
+    }
+
+}

+ 51 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/WarningDialogHelper.java

@@ -0,0 +1,51 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+
+import com.wdkl.ncs.android.component.nursehome.R;
+
+
+public class WarningDialogHelper {
+    private static AlertDialog dialog;
+
+    public static void showDialog(final Activity activity) {
+        if (dialog != null && dialog.isShowing()) {
+            return;
+        }
+
+        View contentView = LayoutInflater.from(activity).inflate(R.layout.warning_dialog_lay, null);
+        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+        builder.setView(contentView);
+        Button button = contentView.findViewById(R.id.confirm_button);
+        button.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                AppUpdateHelper.restartApp(activity);
+            }
+        });
+
+        dialog = builder.create();
+        //dialog.setCanceledOnTouchOutside(false);
+        //dialog.setCancelable(false);
+        dialog.show();
+
+        //设置dialog宽高及位置
+        /*try {
+            Window window = dialog.getWindow();
+            WindowManager.LayoutParams lp = window.getAttributes();
+            lp.width = 600;
+            lp.height = 240;
+            lp.gravity = Gravity.CENTER;
+            window.setAttributes(lp);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }*/
+    }
+}

+ 238 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/util/XCrashUtils.java

@@ -0,0 +1,238 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.app.AlarmManager;
+import android.app.Application;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import com.wdkl.ncs.android.component.nursehome.BuildConfig;
+import com.wdkl.ncs.android.component.nursehome.activity.RegisterActivity;
+import com.wdkl.ncs.android.middleware.api.UrlManager;
+
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.FormBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import xcrash.ICrashCallback;
+import xcrash.TombstoneManager;
+import xcrash.TombstoneParser;
+import xcrash.XCrash;
+
+public class XCrashUtils {
+    private final static String TAG = "XCrashUtils";
+
+    private Application app;
+    private OkHttpClient okHttpClient;
+
+    // callback for java crash, native crash and ANR
+    private final ICrashCallback callback = new ICrashCallback() {
+        @Override
+        public void onCrash(String logPath, String emergency) {
+            Log.d(TAG, "log path: " + (logPath != null ? logPath : "(null)") + ", emergency: " + (emergency != null ? emergency : "(null)"));
+
+            if (emergency != null) {
+                debug(logPath, emergency);
+
+                // Disk is exhausted, send crash report immediately.
+                //sendThenDeleteCrashLog(logPath, emergency);
+            } else {
+                // Add some expanded sections. Send crash report at the next time APP startup.
+
+                // OK
+                TombstoneManager.appendSection(logPath, "expanded_key_1", "expanded_content");
+                TombstoneManager.appendSection(logPath, "expanded_key_2", "expanded_content_row_1\nexpanded_content_row_2");
+
+                // Invalid. (Do NOT include multiple consecutive newline characters ("\n\n") in the content string.)
+                // TombstoneManager.appendSection(logPath, "expanded_key_3", "expanded_content_row_1\n\nexpanded_content_row_2");
+
+                debug(logPath, null);
+            }
+
+            // Disk is exhausted, send crash report immediately.
+            //sendThenDeleteCrashLog(logPath, emergency);
+
+            //非debug版本上传crash日志
+            if (!BuildConfig.DEBUG) {
+                uploadCrashLog(logPath);
+            } else {
+                restartApp();
+            }
+        }
+    };
+
+    //ANR Catcher
+    private final ICrashCallback anrCallback = new ICrashCallback() {
+        @Override
+        public void onCrash(String logPath, String emergency) {
+            Log.d(TAG, "log path: " + (logPath != null ? logPath : "(null)") + ", emergency: " + (emergency != null ? emergency : "(null)"));
+
+            /*if (emergency != null) {
+                debug(logPath, emergency);
+
+                // Disk is exhausted, send crash report immediately.
+                //sendThenDeleteCrashLog(logPath, emergency);
+            } else {
+                // Add some expanded sections. Send crash report at the next time APP startup.
+
+                // OK
+                TombstoneManager.appendSection(logPath, "expanded_key_1", "expanded_content");
+                TombstoneManager.appendSection(logPath, "expanded_key_2", "expanded_content_row_1\nexpanded_content_row_2");
+
+                // Invalid. (Do NOT include multiple consecutive newline characters ("\n\n") in the content string.)
+                // TombstoneManager.appendSection(logPath, "expanded_key_3", "expanded_content_row_1\n\nexpanded_content_row_2");
+
+                debug(logPath, null);
+            }*/
+
+            AppUpdateHelper.reboot(app);
+            //restartApp();
+        }
+    };
+
+    public void init(Application application) {
+        Log.d(TAG, "xCrash SDK init: start ---- is debug version? " + BuildConfig.DEBUG);
+        app = application;
+
+        // Initialize xCrash.
+        XCrash.init(application, new XCrash.InitParameters()
+                .setAppVersion(BuildConfig.VERSION_NAME)
+                .setJavaRethrow(true)
+                .setJavaLogCountMax(10)
+                .setJavaDumpAllThreadsWhiteList(new String[]{"^main$", "^Binder:.*", ".*Finalizer.*"})
+                .setJavaDumpAllThreadsCountMax(10)
+                .setJavaCallback(callback)
+                .setNativeRethrow(true)
+                .setNativeLogCountMax(10)
+                .setNativeDumpAllThreadsWhiteList(new String[]{"^xcrash\\.sample$", "^Signal Catcher$", "^Jit thread pool$", ".*(R|r)ender.*", ".*Chrome.*"})
+                .setNativeDumpAllThreadsCountMax(10)
+                .setNativeCallback(callback)
+                .setAnrRethrow(true)
+                .setAnrLogCountMax(10)
+                .setAnrCallback(anrCallback)
+                .setPlaceholderCountMax(3)
+                .setPlaceholderSizeKb(512)
+                .setLogDir(application.getExternalFilesDir("xcrash").toString())
+                .setLogFileMaintainDelayMs(5000));
+    }
+
+    private void uploadCrashLog(String path) {
+        final File logFile = new File(path);
+        if (logFile.exists()) {
+            final UrlManager urlManager = UrlManager.Companion.build();
+            String url = urlManager.getBuyer() + "ncs/upload/file";
+            HttpHelper.upload(url, logFile, TAG, new HttpHelper.UploadCallback() {
+                @Override
+                public void onFail() {
+                    Log.e(TAG,"错误日志文件上传失败!");
+                    restartApp();
+                }
+
+                @Override
+                public void onSuccess(String data) {
+                    Log.e(TAG,"错误日志文件上传成功!" + data);
+                    sendThenDeleteCrashLog(urlManager.getBuyer() + data, null);
+                    //删除日志文件
+                    //logFile.delete();
+                }
+            });
+        }
+    }
+
+    private void sendThenDeleteCrashLog(final String logPath, String emergency) {
+        try {
+            // Parse
+            //Map<String, String> map = TombstoneParser.parse(logPath, emergency);
+            //String crashReport = new JSONObject(map).toString();
+
+            if(okHttpClient == null){
+                okHttpClient = new OkHttpClient();
+            }
+
+            FormBody.Builder formBody = new FormBody.Builder();
+            formBody.add("class_name", app.getPackageName());
+            formBody.add("method_name", "");
+            formBody.add("exception_name", "");
+            formBody.add("err_msg", "");
+            formBody.add("stack_trace", logPath);
+
+            UrlManager urlManager = UrlManager.Companion.build();
+            Request request  = new Request.Builder()
+                    .url(urlManager.getBuyer() + "device/error_log")
+                    .post(formBody.build())
+                    .build();
+
+            okHttpClient.newCall(request).enqueue(new Callback() {
+                @Override
+                public void onFailure(Call call, IOException e) {
+                    Log.e(TAG,"错误日志名称上传失败"+e.getMessage());
+                    restartApp();
+                }
+
+                @Override
+                public void onResponse(Call call, Response response) throws IOException {
+                    Log.d(TAG,"错误日志名称上传成功");
+                    TombstoneManager.deleteTombstone(logPath);
+                    //String data = response.body().string();
+                    //Log.d(TAG,"错误日志数据 data "+data);
+                    restartApp();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        // Send the crash report to server-side.
+        // ......
+
+        // If the server-side receives successfully, delete the log file.
+        //
+        // Note: When you use the placeholder file feature,
+        //       please always use this method to delete tombstone files.
+        //
+        //TombstoneManager.deleteTombstone(logPath);
+    }
+
+    private void debug(String logPath, String emergency) {
+        // Parse and save the crash info to a JSON file for debugging.
+        FileWriter writer = null;
+        try {
+            File debug = new File(XCrash.getLogDir() + "/debug.json");
+            debug.createNewFile();
+            writer = new FileWriter(debug, false);
+            writer.write(new JSONObject(TombstoneParser.parse(logPath, emergency)).toString());
+        } catch (Exception e) {
+            Log.d(TAG, "debug failed", e);
+        } finally {
+            if (writer != null) {
+                try {
+                    writer.close();
+                } catch (Exception ignored) {
+                }
+            }
+        }
+    }
+
+    private void restartApp() {
+        //重新启动app
+        Intent mStartActivity = new Intent(app.getApplicationContext(), RegisterActivity.class);
+        mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        int mPendingIntentId = 123456;
+        PendingIntent mPendingIntent = PendingIntent.getActivity(app.getApplicationContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
+        AlarmManager mgr = (AlarmManager) app.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
+        mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 2000, mPendingIntent);
+
+        android.os.Process.killProcess(android.os.Process.myPid());
+        System.exit(0);
+    }
+
+}

+ 239 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/window/IncidentWindow.kt

@@ -0,0 +1,239 @@
+package com.wdkl.ncs.android.component.nursehome.window
+
+import android.content.Context
+import android.databinding.DataBindingUtil
+import android.graphics.PixelFormat
+import android.os.Build
+import android.view.*
+import android.view.animation.AlphaAnimation
+import android.view.animation.Animation
+import android.view.animation.LinearInterpolator
+import com.alibaba.android.vlayout.DelegateAdapter
+import com.alibaba.android.vlayout.LayoutHelper
+import com.alibaba.android.vlayout.VirtualLayoutManager
+import com.alibaba.android.vlayout.layout.LinearLayoutHelper
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.component.nursehome.databinding.AdapterEventListItemBinding
+import com.wdkl.ncs.android.component.nursehome.databinding.WindowIncidentBinding
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
+import com.wdkl.ncs.android.component.nursehome.util.*
+import com.wdkl.ncs.android.lib.adapter.BaseDelegateAdapter
+import com.wdkl.ncs.android.lib.utils.BaseRecyclerViewHolder
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.tcp.channel.DeviceChannel
+import com.wdkl.ncs.android.middleware.tcp.channel.OtherUtil
+import com.wdkl.ncs.android.middleware.tcp.enums.DeviceTypeEnum
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
+
+class IncidentWindow(var contexts: Context) {
+    var mWindowManager: WindowManager? = null
+    var view: View? = null
+    var eventTcpList = ArrayList<InteractionVO>()
+
+    var adapter: EventListAdapter? = null
+    private lateinit var virtualLayoutManager: VirtualLayoutManager
+    private lateinit var delegateAdapter: DelegateAdapter
+
+    //创建悬浮按钮
+    fun createFloatView(interactionVO: InteractionVO) {
+        eventTcpList.add(interactionVO)
+        //如果当前没有显示则创建view并显示,如果已经显示则仅更新事件列表
+        if (view == null) {
+            val wmParams = WindowManager.LayoutParams()
+            //获取的是WindowManagerImpl.CompatModeWrapper
+            mWindowManager = contexts.getSystemService(Context.WINDOW_SERVICE) as WindowManager
+            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+                //设置window type 这个只能在8.0以下系统使用
+                wmParams.type = WindowManager.LayoutParams.TYPE_PHONE
+            } else {
+                //8.0及以上系统使用这个
+                wmParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
+            }
+
+            //设置图片格式,效果为背景透明
+            wmParams.format = PixelFormat.RGBA_8888
+            //设置浮动窗口不可聚焦(实现操作除浮动窗口外的其他可见窗口的操作)
+            //wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+            //调整悬浮窗显示的停靠位置为左侧置顶
+//        wmParams.gravity = Gravity.RIGHT or Gravity.TOP
+            wmParams.gravity = Gravity.CENTER_HORIZONTAL;
+            // 以屏幕左上角为原点,设置x、y初始值,相对于gravity
+            wmParams.x = 0
+            wmParams.y = 0
+            //设置悬浮窗口长宽数据
+            wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT
+            wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT
+
+            //获取浮动窗口视图所在布局
+            view = LayoutInflater.from(contexts).inflate(R.layout.window_incident, null)
+            adapter = EventListAdapter(contexts, eventTcpList)
+            /**初始化LayoutMannager*/
+            virtualLayoutManager = VirtualLayoutManager(contexts)
+
+            /**初始化适配器*/
+            delegateAdapter = DelegateAdapter(virtualLayoutManager)
+            delegateAdapter.addAdapter(adapter)
+
+            lateinit var windowIncidentBinding: WindowIncidentBinding
+            windowIncidentBinding = DataBindingUtil.bind(view)
+
+            windowIncidentBinding.rvEventList.layoutManager = virtualLayoutManager
+            windowIncidentBinding.rvEventList.adapter = delegateAdapter
+
+            var alphaAnimation = AlphaAnimation(1.0f, 0.1f)
+            alphaAnimation.duration = 600
+            alphaAnimation.interpolator = LinearInterpolator()
+            alphaAnimation.repeatCount = Animation.INFINITE //表示重复多次
+            alphaAnimation.repeatMode = Animation.REVERSE //表示动画结束后,反过来再执行;RESTART表示从头开始,REVERSE表示从末尾倒播
+            windowIncidentBinding.viewEventTitle.startAnimation(alphaAnimation)
+
+            //添加mFloatLayout
+            mWindowManager!!.addView(view, wmParams)
+
+        } else {
+            adapter!!.updateData(eventTcpList)
+        }
+
+        adapter!!.setOnItemClickListener { data, position ->
+            if (SettingConfig.getTtsMode(contexts) == SettingConfig.TTS_OFF) {
+                RingPlayHelper.stopRingTone()
+            } else {
+                SpeechUtil.getInstance().stopSpeak()
+            }
+            if (data.actionType == TcpType.SOS.name) {
+                OtherUtil.cancelSosCall(Constants.ids, data.fromDeviceId, data.id)
+                LedHelper.updateLedInfo(data, false, true)
+                if (NurseHomeActivity.sosItemList.size > 0) {
+                    val iterator = NurseHomeActivity.sosItemList.iterator()
+                    while (iterator.hasNext()) {
+                        val it = iterator.next()
+                        if (it.interactionVO.id == data.id) {
+                            iterator.remove()
+                        }
+                    }
+                }
+            } else if (data.actionType == TcpType.REINFORCE.name) {
+                OtherUtil.sendReinforceResponsed(Constants.ids, data.fromDeviceId, data.id)
+                LedHelper.updateLedInfo(data, false, false)
+            }
+
+            eventTcpList.remove(data)
+            if (eventTcpList.size > 0) {
+                adapter!!.updateData(eventTcpList)
+            } else {
+                release()
+            }
+        }
+
+    }
+
+
+    /**
+     * 删除窗口
+     */
+    fun release() {
+        DeviceChannel.calling = false
+        Constants.CALL_STATE = Constants.CALL_STANDBY
+        if (view != null) {
+            //移除悬浮窗口
+            mWindowManager?.removeView(view)
+        }
+        eventTcpList.clear()
+        mWindowManager = null
+        view = null
+    }
+
+    fun declineItem(item: InteractionVO) {
+        if (SettingConfig.getTtsMode(contexts) == SettingConfig.TTS_OFF) {
+            RingPlayHelper.stopRingTone()
+        }
+        if(view==null){
+            return
+        }else if (eventTcpList.size==0){
+            release()
+        }else{
+           var event =  eventTcpList.stream().filter{it.id.equals(item.id)}.findFirst().orElse(null)
+            if(event!=null){
+                eventTcpList.remove(event)
+                if (eventTcpList.size > 0) {
+                    adapter!!.updateData(eventTcpList)
+                } else {
+                    release()
+                }
+            }
+
+        }
+    }
+
+
+    class EventListAdapter(var context: Context, var data: ArrayList<InteractionVO>) : BaseDelegateAdapter<BaseRecyclerViewHolder<AdapterEventListItemBinding>, InteractionVO>() {
+        /**
+         * 数据提供者
+         */
+        override fun dataProvider(): Any {
+            return data
+        }
+
+        /**
+         * Item坐标
+         */
+        override fun itemFilter(position: Int): Boolean {
+            return true
+        }
+
+        /**
+         * 获取Item总数
+         */
+        override fun getItemCount(): Int {
+            return data.size
+        }
+
+        /**
+         * 创建LayoutHelper
+         */
+        override fun onCreateLayoutHelper(): LayoutHelper {
+            return LinearLayoutHelper(0, data.size)
+        }
+
+        fun updateData(data: ArrayList<InteractionVO>) {
+            this.data = data
+            notifyDataSetChanged()
+        }
+
+        override fun onCreateViewHolder(
+            p0: ViewGroup?,
+            p1: Int
+        ): BaseRecyclerViewHolder<AdapterEventListItemBinding> {
+            return BaseRecyclerViewHolder.build(p0, R.layout.adapter_event_list_item)
+        }
+
+        override fun onBindViewHolder(
+            p0: BaseRecyclerViewHolder<AdapterEventListItemBinding>?,
+            p1: Int
+        ) {
+            p0?.bind { binding ->
+                val interactionVO = getItem(p1)
+                //房间名称
+                var room = interactionVO.fromFrameFullName.substringBefore("-")
+                //如果分机绑定了紧急按钮则加上紧急按钮名称
+                if (interactionVO.fromDeviceType == DeviceTypeEnum.EMERGENCY_BUTTON.value()
+                    || interactionVO.fromDeviceType == DeviceTypeEnum.SIMULATE_EMERGENCY_BUTTON.value()) {
+                    room = interactionVO.fromDeviceName
+                }
+                /*if (interactionVO.createDate != null) {
+                    binding.incidentTime.text =
+                        TimeTransition.stampToDateTime(interactionVO.createDate * 1000)
+                }*/
+
+                if (interactionVO.actionType == TcpType.SOS.name) {
+                    binding.incidentTv.text = room + " 紧急呼叫"
+                } else if (interactionVO.actionType == TcpType.REINFORCE.name) {
+                    binding.incidentTv.text = room + " 请求增援"
+                }
+            }
+        }
+    }
+
+}

+ 104 - 0
android_host_manager/src/main/zk_h10_z3128_1h/java/com/wdkl/ncs/android/component/nursehome/window/VisitingWindow.java

@@ -0,0 +1,104 @@
+package com.wdkl.ncs.android.component.nursehome.window;
+
+import android.content.Context;
+import android.graphics.PixelFormat;
+import android.os.Build;
+import android.os.SystemClock;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.Chronometer;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.wdkl.ncs.android.component.nursehome.R;
+import com.wdkl.ncs.android.component.nursehome.common.Constants;
+import com.wdkl.ncs.android.middleware.tcp.channel.DeviceChannel;
+import com.wdkl.ncs.android.middleware.tcp.channel.VideoUtil;
+
+public class VisitingWindow {
+
+    private static WindowManager mWindowManager;
+    private static View view;
+
+    //创建悬浮按钮
+    public static void createFloatView(Context context, String text) {
+        //如果当前没有显示则创建view并显示,如果已经显示则仅更新事件列表
+        if (view == null) {
+            WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();
+            //获取的是WindowManagerImpl.CompatModeWrapper
+            mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+                //设置window type 这个只能在8.0以下系统使用
+                wmParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+            } else {
+                //8.0及以上系统使用这个
+                wmParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+            }
+
+            //设置图片格式,效果为背景透明
+            wmParams.format = PixelFormat.RGBA_8888;
+            //设置浮动窗口不可聚焦(实现操作除浮动窗口外的其他可见窗口的操作)
+            //wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+            //调整悬浮窗显示的停靠位置为左侧置顶
+//        wmParams.gravity = Gravity.RIGHT or Gravity.TOP
+            wmParams.gravity = Gravity.CENTER_HORIZONTAL;
+            // 以屏幕左上角为原点,设置x、y初始值,相对于gravity
+            wmParams.x = 0;
+            wmParams.y = 0;
+            //设置悬浮窗口长宽数据
+            wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
+            wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
+
+            //获取浮动窗口视图所在布局
+            view = LayoutInflater.from(context).inflate(R.layout.window_visiting, null);
+
+            TextView title = view.findViewById(R.id.window_visiting_title);
+            final Chronometer time = view.findViewById(R.id.window_visiting_time);
+            ImageView end = view.findViewById(R.id.window_visiting_end);
+
+            title.setText(text + " 正在探视中...");
+            time.setBase(SystemClock.elapsedRealtime());
+            time.start();
+            end.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    time.stop();
+                    //挂断探视机
+                    VideoUtil.handoffVideoCall(Constants.Companion.getIds(), Constants.Companion.getFromId(), Constants.Companion.getInteractionId());
+                    //挂断分机
+                    if (Constants.Companion.getVisitedId() != -1) {
+                        VideoUtil.handoffVideoCall(Constants.Companion.getIds(), Constants.Companion.getVisitedId(), Constants.Companion.getInteractionId());
+                        Constants.Companion.setVisitedId(-1);
+                    }
+                    release();
+                }
+            });
+
+            //添加mFloatLayout
+            mWindowManager.addView(view, wmParams);
+
+        }
+
+    }
+
+
+    /**
+     * 删除窗口
+     */
+    public static void release() {
+        Constants.Companion.setCALL_STATE(Constants.Companion.getCALL_STANDBY());
+        DeviceChannel.calling = false;
+        if (view != null) {
+            Chronometer time = view.findViewById(R.id.window_visiting_time);
+            if (time != null) {
+                time.stop();
+            }
+            //移除悬浮窗口
+            mWindowManager.removeView(view);
+        }
+        mWindowManager = null;
+        view = null;
+    }
+}

+ 7 - 0
android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_down_in.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <translate
+        android:fromYDelta="100%p"
+        android:toYDelta="0%p"
+        android:duration="300"/>
+</set>

+ 7 - 0
android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_left_in.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <translate
+        android:fromXDelta="-100%p"
+        android:toXDelta="0%p"
+        android:duration="300"/>
+</set>

+ 7 - 0
android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_right_out.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <translate
+        android:fromXDelta="0%p"
+        android:toXDelta="100%p"
+        android:duration="300"/>
+</set>

+ 7 - 0
android_host_manager/src/main/zk_h10_z3128_1h/res/anim/slide_up_out.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <translate
+        android:fromYDelta="0%p"
+        android:toYDelta="-100%p"
+        android:duration="300"/>
+</set>

BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bai_zhou_icon.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bei_zhu.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bg_bottom_btn.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bian_qian.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_fang.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_qu.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_qu_xuan_zhong.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_ren_xiang_qing.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/bing_ren_xiang_qing_man.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/dian_hua.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/gua_duan.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/guang_bo.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/guang_bo_xuan_zhong.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/guang_bo_yi_chu.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_chu_wei_jie.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_chu_yi_jie.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_jiao.png


BIN
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_jiao_ji_lu_to_xiang.png


+ 0 - 0
android_host_manager/src/main/zk_h10_z3128_1h/res/drawable-mdpi/hu_ru_wei_jie.png


Неке датотеке нису приказане због велике количине промена