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

<新的点阵屏信息由护士主机来控制显示>

weizhengliang пре 4 година
родитељ
комит
07be5e0608
28 измењених фајлова са 1496 додато и 3 уклоњено
  1. 1 0
      app/build.gradle
  2. 2 0
      app/src/main/AndroidManifest.xml
  3. 2 0
      app/src/main/java/com/wdkl/callingmainnurse/MyApplication.java
  4. 11 0
      app/src/main/java/com/wdkl/callingmainnurse/common/Constants.java
  5. 116 0
      app/src/main/java/com/wdkl/callingmainnurse/entity/DeviceInfoEntity.java
  6. 297 0
      app/src/main/java/com/wdkl/callingmainnurse/service/led/LedC2MManager.java
  7. 42 0
      app/src/main/java/com/wdkl/callingmainnurse/service/led/LedManager.java
  8. 80 0
      app/src/main/java/com/wdkl/callingmainnurse/service/led/LedManagerUtils.java
  9. 4 0
      app/src/main/java/com/wdkl/callingmainnurse/ui/activity/InitActivity.java
  10. 157 0
      app/src/main/java/com/wdkl/callingmainnurse/ui/activity/LedSettingsActivity.java
  11. 4 0
      app/src/main/java/com/wdkl/callingmainnurse/ui/activity/MainFragmentActivity.java
  12. 62 0
      app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/CallingBedFragment.java
  13. 7 2
      app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/SystemSettingFragment.java
  14. 2 0
      app/src/main/java/com/wdkl/callingmainnurse/util/SharedPreferencesUtil.java
  15. 122 0
      app/src/main/res/layout/activity_led_settings_layout.xml
  16. 1 0
      listenvision/.gitignore
  17. 30 0
      listenvision/build.gradle
  18. 0 0
      listenvision/consumer-rules.pro
  19. 21 0
      listenvision/proguard-rules.pro
  20. 27 0
      listenvision/src/androidTest/java/com/listenvision/ExampleInstrumentedTest.java
  21. 2 0
      listenvision/src/main/AndroidManifest.xml
  22. BIN
      listenvision/src/main/assets/simsun.ttc
  23. 64 0
      listenvision/src/main/java/com/listenvision/LedC2M.java
  24. 421 0
      listenvision/src/main/java/com/listenvision/led.java
  25. BIN
      listenvision/src/main/jniLibs/armeabi-v7a/libledplayer7.so
  26. 3 0
      listenvision/src/main/res/values/strings.xml
  27. 17 0
      listenvision/src/test/java/com/listenvision/ExampleUnitTest.java
  28. 1 1
      settings.gradle

+ 1 - 0
app/build.gradle

@@ -100,5 +100,6 @@ dependencies {
     //    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
     compile project(path: ':nurseMainLib')
     compile project(':AmDemo_R')
+    compile project(':listenvision')
     provided files('src/main/jniLibs/frame.jar')
 }

+ 2 - 0
app/src/main/AndroidManifest.xml

@@ -83,6 +83,8 @@
             android:screenOrientation="landscape"></activity>
         <activity android:name=".ui.activity.OtherSettingsActivity"
             android:screenOrientation="landscape"></activity>
+        <activity android:name=".ui.activity.LedSettingsActivity"
+            android:screenOrientation="landscape"></activity>
         <activity
             android:name="com.wdkl.callingmainnurse.ui.activity.APPUpdateActivity"
             android:screenOrientation="landscape"

+ 2 - 0
app/src/main/java/com/wdkl/callingmainnurse/MyApplication.java

@@ -11,6 +11,7 @@ import android.os.IBinder;
 import com.wdkl.callingmainnurse.entity.AllDoctorHostEntity;
 import com.wdkl.callingmainnurse.entity.UdpEntity;
 import com.wdkl.callingmainnurse.service.APPService;
+import com.wdkl.callingmainnurse.service.led.LedManagerUtils;
 import com.wdkl.callingmainnurse.util.ScreenExtinguishUtil;
 import com.wdkl.callingmainnurse.util.SpeechUtil;
 import com.wdkl.callingmainnurse.util.UdpHelper;
@@ -120,6 +121,7 @@ public class MyApplication extends Application {
 
         SpeechUtil.getInstance().init(getApplicationContext());
 
+        LedManagerUtils.getInstance().ledInit(this);
     }
 
     /**

+ 11 - 0
app/src/main/java/com/wdkl/callingmainnurse/common/Constants.java

@@ -1,5 +1,7 @@
 package com.wdkl.callingmainnurse.common;
 
+import android.os.Environment;
+
 import com.wdkl.callingmainnurse.ui.activity.InitActivity;
 
 /**
@@ -80,6 +82,8 @@ public class Constants {
     public static final String CALLINGMAINNURSE_DOCTORLIST = "/WDHS-I/callingMainNurse_DoctorHostList.aspx";
     //系统设置数据
     public static final String SYSTEM_INFO = "/WDHS-I/callingMainNurse_systemInfo.aspx";
+    //所有设备信息
+    public static final String CALLINGMAINNURSE_DEVICE_INFO = "/Mgr/GetWD_DeviceInfoArray.aspx";
 
     /**
      * 检查APP更新版本
@@ -220,6 +224,13 @@ public class Constants {
 
     }
 
+    //设备类型
+    public static String DEVICE_LED = "6";  //点阵屏
+    //灵信LED字体文件路径
+    public static final String C2M_LED_FONT_PATH = Environment.getExternalStorageDirectory().getPath() + "/fonts/simsun.ttc";
+
+    public static boolean ledFontExist = false;
+
     /**
      * 各种呼叫的机型
      * type : 1门口机 2主机 3 子机  4请求增援 5卫生间 6总控机 7护士主机 8医生机 9护士主机转接给医生机  优先等级依次升高   12传统机

+ 116 - 0
app/src/main/java/com/wdkl/callingmainnurse/entity/DeviceInfoEntity.java

@@ -0,0 +1,116 @@
+package com.wdkl.callingmainnurse.entity;
+
+import java.util.List;
+
+public class DeviceInfoEntity {
+
+    private List<DeviceInfo> DeviceInfoArray;
+
+    public List<DeviceInfo> getDeviceInfoArray() {
+        return DeviceInfoArray;
+    }
+
+    public void setDeviceInfoArray(List<DeviceInfo> deviceInfoArray) {
+        DeviceInfoArray = deviceInfoArray;
+    }
+
+    public class DeviceInfo {
+        //"ID":"4059","PARTID":"2003","DEVICE_TYPE":"1","DEVICE_SN":"SZHSI2004160001","DEVICE_MODEL":"WD","DEVICE_SOFT_VER":"S01",
+        // "DEVICE_HARD_VER":"HSI","DEVICE_NAME":"护士主机1","DEVICE_ETH_MAC":"1C:05:00:00:00:29","DEVICE_ETH_IP":"192.168.23.20",
+        // "DEVICE_WIFI_MAC":"FF:FF:FF:FF:FF:FF","DEVICE_WIFI_IP":"","DEVICE_WIFI_HOSTNAME":"","DEVICE_STATUS":"1","DEVICE_ROOM_NUM":"",
+        // "DEVICE_ROOM_ID":"0","DEVICE_BED_NUM":"","DEVICE_BED_NAME":"","DEVICE_HUMAN_TYPE":"0","DEVICE_HUMAN_ID":"0","DEVICE_SIP_IP":"192.168.101.2",
+        // "DEVICE_SIP_ID":"1000040590","DEVICE_SIP_PASSWORD":"1000040590","DEVICE_HOSTING_ID":"4059","DEVICE_IR_CFG":"",
+        // "DEVICE_ZONE0":"0","DEVICE_ZONE1":"0","DEVICE_ZONE2":"0","DEVICE_ZONE3":"0","DEVICE_ZONE4":"0","DEVICE_ZONE5":"0",
+        // "DEVICE_DATETIME":"2020/06/16 12:01:57","Code":"OK!"
+
+        private String ID;
+        private String PARTID;
+        private String DEVICE_TYPE;
+        private String DEVICE_SN;
+        private String DEVICE_MODEL;
+        private String DEVICE_SOFT_VER;
+        private String DEVICE_HARD_VER;
+        private String DEVICE_NAME;
+        private String DEVICE_ETH_MAC;
+        private String DEVICE_ETH_IP;
+        private String DEVICE_WIFI_MAC;
+        private String DEVICE_WIFI_IP;
+        private String DEVICE_WIFI_HOSTNAME;
+        private String DEVICE_STATUS;
+        private String DEVICE_ROOM_NUM;
+        private String DEVICE_ROOM_ID;
+        private String DEVICE_BED_NUM;
+        private String DEVICE_BED_NAME;
+        private String DEVICE_HUMAN_TYPE;
+        private String DEVICE_HUMAN_ID;
+        private String DEVICE_SIP_IP;
+        private String DEVICE_SIP_ID;
+        private String DEVICE_SIP_PASSWORD;
+        private String DEVICE_HOSTING_ID;
+        private String DEVICE_IR_CFG;
+        private String DEVICE_ZONE0;
+        private String DEVICE_ZONE1;
+        private String DEVICE_ZONE2;
+        private String DEVICE_ZONE3;
+        private String DEVICE_ZONE4;
+        private String DEVICE_ZONE5;
+        private String DEVICE_DATETIME;
+        private String Code;
+
+        public String getID() {
+            return ID;
+        }
+
+        public void setID(String ID) {
+            this.ID = ID;
+        }
+
+        public String getPARTID() {
+            return PARTID;
+        }
+
+        public void setPARTID(String PARTID) {
+            this.PARTID = PARTID;
+        }
+
+        public String getDEVICE_TYPE() {
+            return DEVICE_TYPE;
+        }
+
+        public void setDEVICE_TYPE(String DEVICE_TYPE) {
+            this.DEVICE_TYPE = DEVICE_TYPE;
+        }
+
+        public String getDEVICE_NAME() {
+            return DEVICE_NAME;
+        }
+
+        public void setDEVICE_NAME(String DEVICE_NAME) {
+            this.DEVICE_NAME = DEVICE_NAME;
+        }
+
+        public String getDEVICE_ETH_MAC() {
+            return DEVICE_ETH_MAC;
+        }
+
+        public void setDEVICE_ETH_MAC(String DEVICE_ETH_MAC) {
+            this.DEVICE_ETH_MAC = DEVICE_ETH_MAC;
+        }
+
+        public String getDEVICE_ETH_IP() {
+            return DEVICE_ETH_IP;
+        }
+
+        public void setDEVICE_ETH_IP(String DEVICE_ETH_IP) {
+            this.DEVICE_ETH_IP = DEVICE_ETH_IP;
+        }
+
+        public String getDEVICE_STATUS() {
+            return DEVICE_STATUS;
+        }
+
+        public void setDEVICE_STATUS(String DEVICE_STATUS) {
+            this.DEVICE_STATUS = DEVICE_STATUS;
+        }
+    }
+}

+ 297 - 0
app/src/main/java/com/wdkl/callingmainnurse/service/led/LedC2MManager.java

@@ -0,0 +1,297 @@
+package com.wdkl.callingmainnurse.service.led;
+
+import android.app.Application;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.google.gson.Gson;
+import com.listenvision.LedC2M;
+import com.wdkl.callingmainnurse.MyApplication;
+import com.wdkl.callingmainnurse.common.Constants;
+import com.wdkl.callingmainnurse.entity.DeviceInfoEntity;
+import com.wdkl.callingmainnurse.util.SharedPreferencesUtil;
+import com.zhy.http.okhttp.OkHttpUtils;
+import com.zhy.http.okhttp.callback.StringCallback;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import okhttp3.Call;
+
+public class LedC2MManager extends LedManager {
+    private LedC2M ledC2M;
+    private static List<String> ipList = new ArrayList<>();
+    private static List<String> programTextList = new ArrayList<>();
+
+    private final static Object lockObject = new Object();
+
+    private boolean isPowerOn = true;
+
+    @Override
+    public void init(Application application) {
+        ledC2M = new LedC2M();
+        ledC2M.init(application);
+        File file = new File(Constants.C2M_LED_FONT_PATH);
+        if (file.exists()) {
+            Constants.ledFontExist = true;
+        } else {
+            ledC2M.copyFontFile(new LedC2M.LedFontCheck() {
+                @Override
+                public void onChecked(boolean check) {
+                    Constants.ledFontExist = check;
+                }
+            });
+        }
+    }
+
+    @Override
+    public void initIpList() {
+        getLedDeviceIpList();
+    }
+
+    private void getLedDeviceIpList() {
+        OkHttpUtils.post().url(Constants.URL + Constants.URL_END + Constants.CALLINGMAINNURSE_DEVICE_INFO)
+                .addParams("PartID", Constants.PartID)
+                .build()
+                .execute(new StringCallback() {
+                    @Override
+                    public void onError(Call call, Exception e, int id) {
+                        Log.d("led", "getAllDeviceInfo error");
+                    }
+
+                    @Override
+                    public void onResponse(String response, int id) {
+                        String data = response.substring(0, response.length() - 4);
+                        Log.d("led", "getAllDeviceInfo data:== " + data);
+                        try {
+                            Gson gson = new Gson();
+                            DeviceInfoEntity entity = gson.fromJson(data, DeviceInfoEntity.class);
+                            if (entity != null && entity.getDeviceInfoArray() != null && entity.getDeviceInfoArray().size() > 0) {
+                                for (DeviceInfoEntity.DeviceInfo deviceInfo : entity.getDeviceInfoArray()) {
+                                    //获取该科室中添加的LED屏IP地址,只有状态为未启用的才由护士主机来控制,状态为启用的还是通过服务端控制
+                                    if (Constants.DEVICE_LED.equals(deviceInfo.getDEVICE_TYPE()) && "0".equals(deviceInfo.getDEVICE_STATUS())) {
+                                        Log.d("led", "led info: ip=" + deviceInfo.getDEVICE_ETH_IP());
+                                        ipList.add(deviceInfo.getDEVICE_ETH_IP());
+                                    }
+                                }
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+    }
+
+
+    private final ExecutorService updateThreadPool = Executors.newSingleThreadExecutor();
+    private SendProgramThread programThread;
+
+    public class SendProgramThread implements Runnable {
+
+        @Override
+        public void run() {
+            //开始组建节目: 如果字体文件不存在则直接返回
+            if (!Constants.ledFontExist) {
+                return;
+            }
+
+            if (ipList.size() == 0) {
+                return;
+            }
+
+            //创建节目句柄
+            long hProgram = ledC2M.CreateProgram(128, 32, 1,1,3);
+            if (programTextList.size() == 0) {
+                int type = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedInfoType);
+                if (type == 0) {
+                    //仅显示时间
+                    ledC2M.AddProgram(hProgram, 0, 10, 1);
+                    ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.C2M_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 = SharedPreferencesUtil.getStringSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedCustomInfo);
+                    ledC2M.AddProgram(hProgram, 0, 10, 1);
+                    ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.C2M_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.C2M_LED_FONT_PATH, 20,0xff,0,0,0,0,10,0,1,1);
+                    }
+                }
+            } else {
+                //呼叫信息节目
+                String tag = SharedPreferencesUtil.getStringSp(MyApplication.getAppContext(), Constants.MSG_SP, Constants.VOICE_BROADCAST_TAG);
+                for (int i = 0; i < programTextList.size(); i++) {
+                    ledC2M.AddProgram(hProgram, i, 5, 1);
+                    ledC2M.AddImageTextArea(hProgram, i, 1, 0, 0, 128, 32, 0);
+                    if ("1".equals(tag)) {
+                        //显示房间号和床号
+                        ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i), Constants.C2M_LED_FONT_PATH, 16, 0xff, 0, 0, 0, 0, 10, 5, 1, 1);
+                    } else {
+                        //只显示床号
+                        ledC2M.AddMultiLineTextToImageTextArea(hProgram, i, 1, 0, programTextList.get(i), Constants.C2M_LED_FONT_PATH, 20, 0xff, 0, 0, 0, 0, 10, 5, 1, 1);
+                    }
+                }
+            }
+
+            //开始发送节目
+            for (int i = 0; i < ipList.size(); i++) {
+                int result = ledC2M.NetWorkSend(ipList.get(i), hProgram);
+                if (Constants.DEBUG) {
+                    Log.d("led", "send program to " + ipList.get(i) + ", result: " + result);
+                }
+            }
+            ledC2M.DeleteProgram(hProgram);
+        }
+    }
+
+    //更新节目方法: text -- 节目内容,action -- 方式: 1-发送节目,2-删除节目
+    @Override
+    public synchronized void updateProgram(String text, int action) {
+        synchronized (lockObject) {
+            switch (action) {
+                case 1:
+                    if (programTextList.contains(text)) {
+                        return;
+                    }
+                    programTextList.add(0, text);
+                    break;
+                case 2:
+                    if (!programTextList.contains(text)) {
+                        return;
+                    }
+                    programTextList.remove(text);
+                    break;
+            }
+
+            if (programThread == null) {
+                programThread = new SendProgramThread();
+            }
+            updateThreadPool.execute(programThread);
+        }
+    }
+
+    private void sendDefaulProgram(final boolean needReboot) {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                synchronized (lockObject) {
+                    //如果字体文件不存在则直接返回
+                    if (!Constants.ledFontExist) {
+                        return;
+                    }
+
+                    if (ipList.size() == 0) {
+                        return;
+                    }
+
+                    int type = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedInfoType);
+                    //创建节目句柄
+                    long hProgram = ledC2M.CreateProgram(128, 32, 1, 1, 0);
+                    if (type == 0) {
+                        //仅显示时间
+                        ledC2M.AddProgram(hProgram, 0, 10, 1);
+                        ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.C2M_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 = SharedPreferencesUtil.getStringSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedCustomInfo);
+                        ledC2M.AddProgram(hProgram, 0, 10, 1);
+                        ledC2M.AddDigitalClockArea(hProgram, 0, 1, 0, 0, 128, 32, Constants.C2M_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.C2M_LED_FONT_PATH, 20,0xff,0,0,0,0,10,0,1,1);
+                        }
+                    }
+
+                    for (int i = 0; i < ipList.size(); i++) {
+                        int result = ledC2M.NetWorkSend(ipList.get(i), hProgram);
+                        if (Constants.DEBUG) {
+                            Log.d("led", "send program to " + ipList.get(i) + ", result: " + result);
+                        }
+                    }
+
+                    ledC2M.DeleteProgram(hProgram);
+
+                    if (needReboot) {
+                        for (int i = 0; i < ipList.size(); i++) {
+                            ledC2M.PowerOnOff(ipList.get(i), 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 < ipList.size(); i++) {
+                        ledC2M.AdjustTime(ipList.get(i));
+                    }
+                }
+            }
+        }).start();
+    }
+
+    @Override
+    public void powerOnOff() {
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                synchronized (lockObject) {
+                    if (isPowerOn) {
+                        for (int i = 0; i < ipList.size(); i++) {
+                            ledC2M.PowerOnOff(ipList.get(i), 1);
+                        }
+                        isPowerOn = false;
+                    } else {
+                        for (int i = 0; i < ipList.size(); i++) {
+                            ledC2M.PowerOnOff(ipList.get(i), 0);
+                        }
+                        isPowerOn = true;
+                    }
+                }
+            }
+        }).start();
+    }
+
+    @Override
+    public void release() {
+        programTextList.clear();
+    }
+}

+ 42 - 0
app/src/main/java/com/wdkl/callingmainnurse/service/led/LedManager.java

@@ -0,0 +1,42 @@
+package com.wdkl.callingmainnurse.service.led;
+
+import android.app.Application;
+
+
+import com.wdkl.callingmainnurse.common.Constants;
+
+import java.io.File;
+
+public abstract class LedManager {
+
+    //初始化
+    public abstract void init(Application application);
+
+    //获取所有LED屏ip地址
+    public abstract void initIpList();
+
+    //更新节目: 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 boolean checkLedFont() {
+        File file = new File(Constants.C2M_LED_FONT_PATH);
+        if (file.exists()) {
+            Constants.ledFontExist = true;
+        } else {
+            Constants.ledFontExist = false;
+        }
+
+        return Constants.ledFontExist;
+    }
+}

+ 80 - 0
app/src/main/java/com/wdkl/callingmainnurse/service/led/LedManagerUtils.java

@@ -0,0 +1,80 @@
+package com.wdkl.callingmainnurse.service.led;
+
+import android.app.Application;
+
+import com.wdkl.callingmainnurse.util.ToastUtil;
+
+
+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 updateProgram(String text, int action) {
+        if (ledManager != null) {
+            ledManager.updateProgram(text, action);
+        }
+    }
+
+    public void updateDefaultProgram() {
+        if (ledManager != null) {
+            ledManager.updateDefaultProgram();
+        }
+    }
+
+    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) {
+            if (ledManager.checkLedFont()) {
+                ToastUtil.showToast("字体文件存在!");
+            } else {
+                ToastUtil.showToast("字体文件不存在,可能需要重启设备!");
+            }
+        }
+    }
+
+    public void release() {
+        if (ledManager != null) {
+            ledManager.release();
+        }
+    }
+}

+ 4 - 0
app/src/main/java/com/wdkl/callingmainnurse/ui/activity/InitActivity.java

@@ -115,6 +115,10 @@ public class InitActivity extends BaseActivity implements SerialPortUtil.IForBro
         serialPortUtil.setOnBroadcastClickListener(this);
         serialPortUtil.setOnDataReceiveStringListener(this);
 
+        if (-100 == SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedInfoType)) {
+            SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedInfoType, 0);
+        }
+
         if (-100 == SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.TtsOn)) {
             SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.TtsOn, 0);
         }

+ 157 - 0
app/src/main/java/com/wdkl/callingmainnurse/ui/activity/LedSettingsActivity.java

@@ -0,0 +1,157 @@
+package com.wdkl.callingmainnurse.ui.activity;
+
+import android.support.v7.widget.Toolbar;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+
+import com.wdkl.callingmainnurse.MyApplication;
+import com.wdkl.callingmainnurse.R;
+import com.wdkl.callingmainnurse.base.BaseActivity;
+import com.wdkl.callingmainnurse.common.Constants;
+import com.wdkl.callingmainnurse.entity.MessageEvent;
+import com.wdkl.callingmainnurse.service.led.LedManagerUtils;
+import com.wdkl.callingmainnurse.util.LogUtil;
+import com.wdkl.callingmainnurse.util.SharedPreferencesUtil;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+import butterknife.Bind;
+
+public class LedSettingsActivity extends BaseActivity {
+
+    @Bind(R.id.activity_led_settings_layout_tb)
+    Toolbar toolbar;
+
+    @Bind(R.id.btn_sync_time)
+    Button ledSyncTime;
+    @Bind(R.id.btn_reset_led)
+    Button ledReset;
+    @Bind(R.id.btn_power_on_off)
+    Button ledPower;
+    @Bind(R.id.btn_check_font)
+    Button ledCheckFont;
+    @Bind(R.id.btn_refresh_led_device)
+    Button ledRefresh;
+
+    @Bind(R.id.group_led_info_type)
+    RadioGroup groupLedType;
+    @Bind(R.id.rb_date_time)
+    RadioButton rbDateTime;
+    @Bind(R.id.rb_custom_info)
+    RadioButton rbCustomInfo;
+    @Bind(R.id.led_custom_content)
+    EditText editCustemInfo;
+
+
+    private long syncTime = 0;
+    private long deleProgramTime = 0;
+    private boolean updateLed = false;
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.activity_led_settings_layout;
+    }
+
+    @Override
+    protected void initToolbar() {
+        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                String info = editCustemInfo.getEditableText().toString().trim();
+                SharedPreferencesUtil.putStringSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedCustomInfo, info);
+                if (updateLed) {
+                    LedManagerUtils.getInstance().updateDefaultProgram();
+                }
+                finish();
+            }
+        });
+    }
+
+    @Override
+    protected void initView() {
+        final int type = SharedPreferencesUtil.getIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedInfoType);
+        final String info = SharedPreferencesUtil.getStringSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedCustomInfo);
+        if (type == 0) {
+            rbDateTime.setChecked(true);
+            editCustemInfo.setVisibility(View.INVISIBLE);
+        } else if (type == 1){
+            rbCustomInfo.setChecked(true);
+            editCustemInfo.setVisibility(View.VISIBLE);
+            editCustemInfo.setText(info);
+        }
+
+        groupLedType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(RadioGroup group, int checkedId) {
+                if (checkedId == R.id.rb_date_time) {
+                    updateLed = (type == 1);
+                    editCustemInfo.setVisibility(View.INVISIBLE);
+                    SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedInfoType, 0);
+                } else if (checkedId == R.id.rb_custom_info){
+                    updateLed = (type == 0);
+                    editCustemInfo.setVisibility(View.VISIBLE);
+                    editCustemInfo.setText(info);
+                    SharedPreferencesUtil.putIntSp(MyApplication.getAppContext(), Constants.MSG_SP, SharedPreferencesUtil.LedInfoType, 1);
+                }
+            }
+        });
+
+
+        ledSyncTime.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                long curTime = System.currentTimeMillis();
+                if (curTime - syncTime > 3000) {
+                    syncTime = curTime;
+                    LedManagerUtils.getInstance().syncTime();
+                }
+            }
+        });
+
+        ledReset.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                long curTime = System.currentTimeMillis();
+                if (curTime - deleProgramTime > 3000) {
+                    deleProgramTime = curTime;
+                    LedManagerUtils.getInstance().removeAllProgram();
+                }
+            }
+        });
+
+        ledPower.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                LedManagerUtils.getInstance().powerOnOff();
+            }
+        });
+
+        ledCheckFont.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                LedManagerUtils.getInstance().checkFontFile();
+            }
+        });
+
+        ledRefresh.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                LedManagerUtils.getInstance().initIp();
+            }
+        });
+    }
+
+    @Override
+    protected void initData() {
+        //
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    public void onMoonEvent(MessageEvent messageEvent) {
+    }
+}

+ 4 - 0
app/src/main/java/com/wdkl/callingmainnurse/ui/activity/MainFragmentActivity.java

@@ -33,6 +33,7 @@ import com.wdkl.callingmainnurse.entity.InitDataEntity;
 import com.wdkl.callingmainnurse.entity.MessageEntity;
 import com.wdkl.callingmainnurse.entity.MessageEvent;
 import com.wdkl.callingmainnurse.receive.NetworkConnectChangedReceiver;
+import com.wdkl.callingmainnurse.service.led.LedManagerUtils;
 import com.wdkl.callingmainnurse.ui.fragment.BroadcastFragment;
 import com.wdkl.callingmainnurse.ui.fragment.CallingBedFragment;
 import com.wdkl.callingmainnurse.ui.fragment.CallingHostFragment;
@@ -269,6 +270,9 @@ public class MainFragmentActivity extends FragmentActivity implements IVvsipServ
         //语音留言数据
         PopupwindowVoiceNoticeUtil.initialModelVoiceList(this);
         mVoiceCustomerShowListTemp.addAll(mVoiceCustomerShowList);
+
+        //获取点阵屏设备IP地址
+        LedManagerUtils.getInstance().initIp();
     }
 
     @Override

+ 62 - 0
app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/CallingBedFragment.java

@@ -43,6 +43,7 @@ import com.wdkl.callingmainnurse.entity.MessageEvent;
 import com.wdkl.callingmainnurse.entity.RoomEntity;
 import com.wdkl.callingmainnurse.entity.SystemInfoEntity;
 import com.wdkl.callingmainnurse.entity.UdpEntity;
+import com.wdkl.callingmainnurse.service.led.LedManagerUtils;
 import com.wdkl.callingmainnurse.ui.activity.MainFragmentActivity;
 import com.wdkl.callingmainnurse.ui.activity.SysCallingVolSetActivity;
 import com.wdkl.callingmainnurse.util.ListComparatorUtil;
@@ -701,6 +702,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
         for (int i=0; i< MyApplication.callEntityList.size(); i++) {//将列表也删除该元素 两种实体格式不一样,所以要用循环
             if(MyApplication.callEntityList.get(i).equals(deleteEntity)) {
                 MyApplication.callEntityList.remove(i);
+                //点阵屏处理
+                updateLedInfo(deleteEntity, false);
             }
         }
 
@@ -1385,6 +1388,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                                         }
                                     }
                                     ((MyApplication) getActivity().getApplication()).callEntityList.remove(callingEntity);
+                                    //点阵屏处理
+                                    updateLedInfo(callingEntity, false);
                                     sendNoAnyRequestDoor(callingEntity);
                                     callingEntity = null;
                                     sendCallWaitingNumber(MyApplication.callEntityList.size());
@@ -1407,6 +1412,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                         }
                         if (removeEntity != null) {
                             MyApplication.callEntityList.remove(removeEntity);
+                            //点阵屏处理
+                            updateLedInfo(removeEntity, false);
                             sendNoAnyRequestDoor(removeEntity);
                             sendCallWaitingNumber(MyApplication.callEntityList.size());
                             callListAdapter.notifyDataSetChanged();
@@ -1520,6 +1527,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                             if (!MyApplication.callEntityList.contains(udpEntity)) {
                                 if (isHaveThisWSHtype(udpEntity)) return;
                                 MyApplication.callEntityList.add(udpEntity);
+                                //点阵屏处理
+                                updateLedInfo(udpEntity, true);
                                 setPowerLed("2");//有电话过来就让电源灯闪 Waderson  20171221
                                 sortList();//在此执行排序 Waderson  20171031
                                 sendCallWaitingNumber(MyApplication.callEntityList.size());
@@ -1727,6 +1736,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                 }
             }
             ((MyApplication) getActivity().getApplication()).callEntityList.remove(removeEntity);
+            //点阵屏处理
+            updateLedInfo(removeEntity, false);
             callListAdapter.notifyDataSetChanged();
             roomAdapter.notifyDataSetChanged();
             if (!StringUtils.listNotEmpty(((MyApplication) getActivity().getApplication()).callEntityList)) {
@@ -1820,6 +1831,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                         if (null != urgentUdpEntity && urgentUdpEntity.equals(MyApplication.callEntityList.get(i))) {
                             if (null != urgentPopupwindow) urgentPopupwindow.dismiss();
                         }
+                        //点阵屏处理
+                        updateLedInfo(MyApplication.callEntityList.get(i), false);
                         endCallNotifi(MyApplication.callEntityList.get(i));
                         sendRemoveBack(MyApplication.callEntityList.get(i));
                         MyApplication.callEntityList.remove(i);
@@ -1946,6 +1959,51 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
         return text;
     }
 
+
+    //更新点阵屏节目,添加则isAdd==true,删除则isAdd==false
+    private void updateLedInfo(UdpEntity entity, boolean isAdd) {
+        //如果设置的是从机则不处理
+        if (Constants.isSlaveOn == 1 || entity == null) {
+            return;
+        }
+
+        //是否显示房号: 0--不显示房  1--显示房和床
+        String tag = SharedPreferencesUtil.getStringSp(getActivity(), Constants.MSG_SP, Constants.VOICE_BROADCAST_TAG);
+        String type = entity.getType();
+        String rnb = entity.getRoomNumber();
+        String bnb = entity.getBedNumber();
+        if (Constants.DEBUG) {
+            Log.d(TAG, "updateLedInfo==> tag: " + tag + ", type: " + type + ", room no: " + rnb + ", bed no: " + bnb + ", isAdd: " + isAdd);
+        }
+
+        String ledStr = "";
+        switch (type) {
+            case Constants.SON_CALL://床位
+            case Constants.TRADITION_CALL://传统床位
+                if ("1".equals(tag)) {
+                    ledStr = rnb + "房" + bnb + "床呼叫";
+                } else {
+                    ledStr = bnb + "床呼叫";
+                }
+                break;
+            case Constants.WSHROOM_CALL://卫生间
+                ledStr = rnb + "房卫生间";
+                break;
+        }
+
+        if (!TextUtils.isEmpty(ledStr)) {
+            if (Constants.DEBUG) {
+                Log.d(TAG, "update led: " + ledStr);
+            }
+            if (isAdd) {
+                LedManagerUtils.getInstance().updateProgram(ledStr, 1);
+            } else {
+                LedManagerUtils.getInstance().updateProgram(ledStr, 2);
+            }
+        }
+    }
+
+
     /**
      * 护理改变UI
      */
@@ -1994,6 +2052,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                     }
 
                     MyApplication.callEntityList.remove(udpEntity);
+                    //点阵屏处理
+                    updateLedInfo(udpEntity, false);
                     endCallNotifi(udpEntity);
                     sendNoAnyRequestDoor(udpEntity);
                     sendCallWaitingNumber(MyApplication.callEntityList.size());
@@ -2032,6 +2092,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                     endCallNotifi(callEntityList.get(i));
                     sendNoAnyRequestDoor(callEntityList.get(i));
                     MyApplication.callEntityList.remove(callEntityList.get(i));
+                    //点阵屏处理
+                    updateLedInfo(callEntityList.get(i), false);
                 }
             }
 

+ 7 - 2
app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/SystemSettingFragment.java

@@ -21,6 +21,7 @@ import com.wdkl.callingmainnurse.adapter.SettingAdapter;
 import com.wdkl.callingmainnurse.base.BaseFragment;
 import com.wdkl.callingmainnurse.common.Constants;
 import com.wdkl.callingmainnurse.entity.MessageEvent;
+import com.wdkl.callingmainnurse.ui.activity.LedSettingsActivity;
 import com.wdkl.callingmainnurse.ui.activity.MainFragmentActivity;
 import com.wdkl.callingmainnurse.ui.activity.OtherSettingsActivity;
 import com.wdkl.callingmainnurse.ui.activity.SysBrightSetActivity;
@@ -149,6 +150,7 @@ public class SystemSettingFragment extends BaseFragment implements SettingAdapte
         itemNameList.add("系统声音设置");
         itemNameList.add("系统LED设置");
         itemNameList.add("系统通话音量设置");
+        itemNameList.add("点阵屏设置");
         itemNameList.add("其他设置");
         itemNameList.add("检查升级");
         itemNameList.add("查询异常日志");
@@ -230,12 +232,15 @@ public class SystemSettingFragment extends BaseFragment implements SettingAdapte
                 getActivity().startActivity(new Intent(getActivity(), SysCallingVolSetActivity.class));
                 break;
             case 4:
-                getActivity().startActivity(new Intent(getActivity(), OtherSettingsActivity.class));
+                getActivity().startActivity(new Intent(getActivity(), LedSettingsActivity.class));
                 break;
             case 5:
-                ((MainFragmentActivity)getActivity()).appCheckUpdate();
+                getActivity().startActivity(new Intent(getActivity(), OtherSettingsActivity.class));
                 break;
             case 6:
+                ((MainFragmentActivity)getActivity()).appCheckUpdate();
+                break;
+            case 7:
                 getActivity().startActivity(new Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS));
                 break;
         }

+ 2 - 0
app/src/main/java/com/wdkl/callingmainnurse/util/SharedPreferencesUtil.java

@@ -27,6 +27,8 @@ public class SharedPreferencesUtil {
     public static final String SlaveDeviceOn = "SlaveDeviceOn";
     public static final String HostDeviceId = "HostDeviceId";
     public static final String TtsOn = "TtsOn";
+    public static final String LedInfoType = "LedInfoType";
+    public static final String LedCustomInfo = "LedCustomInfo";
 
     private static SharedPreferencesUtil mSharedPreferencesUtil;
 

+ 122 - 0
app/src/main/res/layout/activity_led_settings_layout.xml

@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@mipmap/bg_main"
+    android:orientation="vertical">
+
+    <android.support.v7.widget.Toolbar
+        android:id="@+id/activity_led_settings_layout_tb"
+        android:layout_width="match_parent"
+        android:layout_height="80dp"
+        android:layout_marginTop="@dimen/margin_10dp"
+        app:navigationIcon="@mipmap/ic_arrow_back"/>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="8dp"
+        android:gravity="center_vertical">
+        <Button
+            android:id="@+id/btn_sync_time"
+            android:layout_width="0dp"
+            android:layout_height="60dp"
+            android:layout_weight="1"
+            android:layout_margin="4dp"
+            android:text="校正点阵屏时间"
+            android:textSize="24sp"
+            android:background="@drawable/selector_setting_button"/>
+        <Button
+            android:id="@+id/btn_reset_led"
+            android:layout_width="0dp"
+            android:layout_height="60dp"
+            android:layout_weight="1"
+            android:layout_margin="4dp"
+            android:text="重置点阵屏"
+            android:textSize="24sp"
+            android:background="@drawable/selector_setting_button"/>
+        <Button
+            android:id="@+id/btn_power_on_off"
+            android:layout_width="0dp"
+            android:layout_height="60dp"
+            android:layout_weight="1"
+            android:layout_margin="4dp"
+            android:text="开/关点阵屏"
+            android:textSize="24sp"
+            android:background="@drawable/selector_setting_button"/>
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="8dp"
+        android:gravity="center_vertical">
+        <Button
+            android:id="@+id/btn_check_font"
+            android:layout_width="0dp"
+            android:layout_height="60dp"
+            android:layout_weight="1"
+            android:layout_margin="4dp"
+            android:text="检查字体文件"
+            android:textSize="24sp"
+            android:background="@drawable/selector_setting_button"/>
+        <Button
+            android:id="@+id/btn_refresh_led_device"
+            android:layout_width="0dp"
+            android:layout_height="60dp"
+            android:layout_weight="1"
+            android:layout_margin="4dp"
+            android:text="更新点阵屏设备列表"
+            android:textSize="24sp"
+            android:background="@drawable/selector_setting_button"/>
+    </LinearLayout>
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="20dp"
+        android:layout_marginStart="20dp"
+        android:layout_marginEnd="20dp">
+        <TextView
+            android:id="@+id/led_info_type_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="点阵屏默认显示内容:"
+            android:textSize="24sp"
+            android:textColor="@color/white"/>
+        <RadioGroup
+            android:id="@+id/group_led_info_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toRightOf="@id/led_info_type_title"
+            android:layout_marginLeft="40dp"
+            android:orientation="horizontal">
+            <RadioButton
+                android:id="@+id/rb_date_time"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="仅日期时间"
+                android:textColor="@color/white"
+                android:textSize="24sp"/>
+            <RadioButton
+                android:id="@+id/rb_custom_info"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="40dp"
+                android:text="添加自定义"
+                android:textColor="@color/white"
+                android:textSize="24sp"/>
+        </RadioGroup>
+
+        <EditText
+            android:id="@+id/led_custom_content"
+            android:layout_height="wrap_content"
+            android:layout_width="match_parent"
+            android:layout_below="@id/led_info_type_title"
+            android:layout_marginTop="10dp"
+            android:textSize="24sp"
+            android:visibility="invisible"/>
+    </RelativeLayout>
+
+</LinearLayout>

+ 1 - 0
listenvision/.gitignore

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

+ 30 - 0
listenvision/build.gradle

@@ -0,0 +1,30 @@
+apply plugin: 'com.android.library'
+
+android {
+
+    compileSdkVersion 26
+    buildToolsVersion "26.0.1"
+    defaultConfig {
+        minSdkVersion 19
+        targetSdkVersion 26
+        versionCode 1
+        versionName "1.0"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+
+}
+
+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'
+    })
+    compile 'com.android.support:appcompat-v7:24.2.0'
+    testCompile 'junit:junit:4.12'
+}

+ 0 - 0
listenvision/consumer-rules.pro


+ 21 - 0
listenvision/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

+ 27 - 0
listenvision/src/androidTest/java/com/listenvision/ExampleInstrumentedTest.java

@@ -0,0 +1,27 @@
+package com.listenvision;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+    @Test
+    public void useAppContext() {
+        // Context of the app under test.
+        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+
+        assertEquals("com.listenvision.test", appContext.getPackageName());
+    }
+}

+ 2 - 0
listenvision/src/main/AndroidManifest.xml

@@ -0,0 +1,2 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.listenvision" />

BIN
listenvision/src/main/assets/simsun.ttc


+ 64 - 0
listenvision/src/main/java/com/listenvision/LedC2M.java

@@ -0,0 +1,64 @@
+package com.listenvision;
+
+import android.app.Application;
+import android.content.Context;
+import android.os.Environment;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+public class LedC2M extends led {
+
+    private Context context;
+    private LedFontCheck callBack;
+
+    public void init(Application application) {
+        context = application.getApplicationContext();
+    }
+
+    public void copyFontFile(LedFontCheck checkCallBack) {
+        callBack = checkCallBack;
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                copyAssetsToDst(context, "simsun.ttc", Environment.getExternalStorageDirectory().getPath() + "/fonts");
+            }
+        }).start();
+    }
+
+    //拷贝assets下面的文件到sd卡
+    private void copyAssetsToDst(Context context, String fileName, String dstPath) {
+        try {
+            File file = new File(dstPath);
+            if (!file.exists()) {
+                file.mkdirs();
+            }
+            File outFile = new File(dstPath + "/" + fileName);
+            InputStream is = context.getAssets().open(fileName);
+            FileOutputStream fos = new FileOutputStream(outFile);
+            byte[] buffer = new byte[1024];
+            int byteCount;
+            while ((byteCount = is.read(buffer)) != -1) {
+                fos.write(buffer, 0, byteCount);
+            }
+            fos.flush();
+            is.close();
+            fos.close();
+            if (callBack != null) {
+                callBack.onChecked(true);
+            }
+        } catch (Exception e) {
+            if (callBack != null) {
+                callBack.onChecked(false);
+            }
+            e.printStackTrace();
+        }
+    }
+
+
+
+    public interface LedFontCheck {
+        void onChecked(boolean check);
+    }
+}

+ 421 - 0
listenvision/src/main/java/com/listenvision/led.java

@@ -0,0 +1,421 @@
+package com.listenvision;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class led {
+	
+	/*
+	 *****************************************************************************************************************
+	 *								LED SDK 7.0
+	 *
+	 *								胡伟(HuWei)
+	 *	
+	 *
+	 *								(C) Copyright 2006 - 2020, LISTEN VISION
+	 *											All Rights Reserved
+	 *														  
+	 *****************************************************************************************************************
+	 */
+	 
+	       /*  特技值对应
+            0=立即显示
+            1=随机
+            2=左移
+            3=右移
+            4=上移
+            5=下移
+            6=连续左移
+            7=连续右移
+            8=连续上移
+            9=连续下移
+            10=闪烁
+            11=激光字(向上)
+            12=激光字(向下)
+            13=激光字(向左)
+            14=激光字(向右)
+            15=水平交叉拉幕
+            16=上下交叉拉幕
+            17=左右切入
+            18=上下切入
+            19=左覆盖
+            20=右覆盖
+            21=上覆盖
+            22=下覆盖
+            23=水平百叶(左右)
+            24=水平百叶(右左)
+            25=垂直百叶(上下)
+            26=垂直百叶(下上)
+            27=左右对开
+            28=上下对开
+            29=左右闭合
+            30=上下闭合
+            31=向左拉伸
+            32=向右拉伸
+            33=向上拉伸
+            34=向下拉伸
+            35=分散向左拉伸
+            36=分散向右拉伸
+            37=冒泡
+            38=下雪
+         */
+	
+	/********************************************************************************************
+	 *	CreateProgram				创建节目对象,成功返回节目对象句柄
+	 *
+	 *	参数说明
+	 *				LedWidth		屏的宽度
+	 *				LedHeight		屏的高度
+	 *				ColorType		屏的颜色 1.单色  2.双基色  3.三基色
+	 *				GrayLevel		灰度等级  赋值  1-5对应的灰度等级分别为 无,4,8,16,32
+	 *				SaveType		节目保存位置,默认为0保存为flash节目,3保存为ram节目
+	 *	返回值
+	 *				0				创建节目对象失败
+	 *				非0				创建节目对象成功
+	 ********************************************************************************************/
+	public native long CreateProgram(int LedWidth,int LedHeight,int ColorType,int GrayLevel,int SaveType);
+	
+	/*********************************************************************************************
+	 *	AddProgram					添加一个节目
+	 *	
+	 *	参数说明
+	 *				hProgram		节目对象句柄
+	 *				ProgramNo		节目号(取值范围0-255)(从0开始)
+	 *				ProgramTime		节目播放时长 0.节目播放时长  非0.指定播放时长
+	 *				LoopCount		循环播放次数
+	 *	返回值
+	 *				0				成功
+	 *				非0				失败	
+	 ********************************************************************************************/
+	public native int AddProgram(long hProgram,int ProgramNo,int ProgramTime,int LoopCount);
+	
+	/*********************************************************************************************
+	 *	LV_AddImageTextArea				添加一个图文区域
+	 *	
+	 *	参数说明
+	 *				hProgram			节目对象句柄
+	 *				ProgramNo			节目号(取值范围0-255)(从0开始)
+	 *				AreaNo				区域号(取值范围1-255)
+	 *				l					区域左上角横坐标
+	 *				t					区域左上角纵坐标
+	 *				w					区域宽度
+	 *				h					区域高度
+	 *				nLayout				区域层号,7代卡只能为0
+	 *	返回值
+	 *				0					成功
+	 *				非0					失败	
+	 ********************************************************************************************/
+	public native int AddImageTextArea(long hProgram,int ProgramNo,int AreaNo,int l,int t,int w,int h,int nLayout);
+	
+	/*********************************************************************************************
+	 * AddFileToImageTextArea				添加一个文件到图文区
+	 *	
+	 *	参数说明
+	 *				hProgram				节目对象句柄
+	 *				ProgramNo				节目号(取值范围0-255)(从0开始)
+	 *				AreaNo					区域号(取值范围1-255)
+	 *				FilePath				文件路径,支持的文件类型有 txt   bmp  jpg jpeg 
+	 *				InStyle					入场特技(取值范围 0-38)
+	 *				nSpeed					特技速度 (取值范围1-255)值越大,速度越慢
+	 *				DelayTime				停留时间 (1-65535)
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败	
+	 ********************************************************************************************/
+	public native int AddFileToImageTextArea(long hProgram,int ProgramNo,int AreaNo,String FilePath,int InStyle,int nSpeed,int DelayTime);
+	
+	/*********************************************************************************************
+	 * AddMultiLineTextToImageTextArea		添加一个多行文本到图文区
+	 *	
+	 *	参数说明
+	 *				hProgram				节目对象句柄
+	 *				ProgramNo				节目号(取值范围0-255)(从0开始)
+	 *				AreaNo					区域号(取值范围1-255)
+	 *				AddType					添加的类型  0.为字符串  1.文件(只支持txt)
+	 *				AddStr					AddType为0则为字符串数据,AddType为1则为文件路径
+	 *				FontName				字体路径	
+	 *				FontSize				字体大小
+	 *				FontColor				字体颜色   0xff 红色  0xff00 绿色  0xffff黄色
+	 *				FontBold				是否加粗 0不加粗 1加粗
+	 *				FontItalic				是否是斜体  0 不斜 1斜
+	 *				FontUnderline			是否下划线 0不加下划线 1加下划线
+	 *				InStyle					入场特技(取值范围 0-38)
+	 *				nSpeed					特技速度 (取值范围1-255)值越大,速度越慢
+	 *				DelayTime				停留时间 (1-65535)
+	 *				nAlignment				左右居中对齐方式 0.左对齐  1.水平居中  2.右对齐  (注意:只对字符串和txt文件有效)
+	 *				IsVCenter				是否垂直居中  0.置顶(默认) 1.垂直居中
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int AddMultiLineTextToImageTextArea(long hProgram,int ProgramNo,int AreaNo,int AddType,String AddStr,String FontName,int FontSize,int FontColor,int FontBold,int FontItalic,int FontUnderline,int InStyle,int nSpeed,int DelayTime,int nAlignment,int IsVCenter);
+	
+	/*********************************************************************************************
+	 * AddStaticTextToImageTextArea			添加一个静止文本到图文区
+	 *	
+	 *	参数说明
+	 *				hProgram				节目对象句柄
+	 *				ProgramNo				节目号(取值范围0-255)(从0开始)
+	 *				AreaNo					区域号(取值范围1-255)
+	 *				AddType					添加的类型  0.为字符串  1.文件(只支持txt)
+	 *				AddStr					AddType为0则为字符串数据,AddType为1则为文件路径
+	 *				FontName				字体路径	
+	 *				FontSize				字体大小
+	 *				FontColor				字体颜色   0xff 红色  0xff00 绿色  0xffff黄色
+	 *				FontBold				是否加粗 0不加粗 1加粗
+	 *				FontItalic				是否是斜体  0 不斜 1斜
+	 *				FontUnderline			是否下划线 0不加下划线 1加下划线
+	 *				DelayTime				停留时间	(1-65535)
+	 *				nAlignment				左右居中对齐方式 0.左对齐  1.水平居中  2.右对齐  (注意:只对字符串和txt文件有效)
+	 *				IsVCenter				是否垂直居中  0.置顶(默认) 1.垂直居中
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int AddStaticTextToImageTextArea(long hProgram,int ProgramNo,int AreaNo,int AddType,String AddStr,String FontName,int FontSize,int FontColor,int FontBold,int FontItalic,int FontUnderline,int DelayTime,int nAlignment,int IsVCenter);
+	
+	/*********************************************************************************************
+	 * AddSinglelineTextToImageTextArea		添加一个多行文本到图文区
+	 *	
+	 *	参数说明
+	 *				hProgram				节目对象句柄
+	 *				ProgramNo				节目号(取值范围0-255)(从0开始)
+	 *				AreaNo					区域号(取值范围1-255)
+	 *				AddType					添加的类型  0.为字符串  1.文件(只支持txt)
+	 *				AddStr					AddType为0则为字符串数据,AddType为1则为文件路径
+	 *				FontName				字体路径	
+	 *				FontSize				字体大小
+	 *				FontColor				字体颜色   0xff 红色  0xff00 绿色  0xffff黄色
+	 *				FontBold				是否加粗 0不加粗 1加粗
+	 *				FontItalic				是否是斜体  0 不斜 1斜
+	 *				FontUnderline			是否下划线 0不加下划线 1加下划线
+	 *				InStyle					入场特技 (取值范围 0-38)
+	 *				nSpeed					特技速度  (取值范围1-255)
+	 *				DelayTime				停留时间  (1-65535)
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int AddSinglelineTextToImageTextArea(long hProgram,int ProgramNo,int AreaNo,int AddType,String AddStr,String FontName,int FontSize,int FontColor,int FontBold,int FontItalic,int FontUnderline,int InStyle,int nSpeed,int DelayTime);
+	
+	/*********************************************************************************************
+	 * AddSinglelineTextToImageTextArea		添加一个多行文本到图文区
+	 *	
+	 *	参数说明
+	 *				hProgram				节目对象句柄
+	 *				ProgramNo				节目号 (取值范围0-255)(从0开始)
+	 *				AreaNo					区域号 (取值范围1-255)
+	 *				l						区域左上角横坐标
+	 *				t						区域左上角纵坐标
+	 *				w						区域宽度
+	 *				h						区域高度
+	 *				FontName				字体路径	
+	 *				FontSize				字体大小
+	 *				FontColor				字体颜色   0xff 红色  0xff00 绿色  0xffff黄色
+	 *				FontBold				是否加粗 0不加粗 1加粗
+	 *				FontItalic				是否是斜体  0 不斜 1斜
+	 *				FontUnderline			是否下划线 0不加下划线 1加下划线
+	 * 				IsYear					是否显示年 1为显示 0不显示 下同
+	 * 				IsWeek					是否显示星期	
+	 *				IsMonth					是否显示月
+	 *				IsDay					是否显示日
+	 *				IsHour					是否显示时
+	 *				IsMinute				是否显示分
+	 *				IsSecond				是否显示秒
+	 *				DateFormat				日期格式 0.YYYY年MM月DD日  1.YY年MM月DD日  2.MM/DD/YYYY  3.YYYY/MM/DD  4.YYYY-MM-DD  5.YYYY.MM.DD  6.MM.DD.YYYY  7.DD.MM.YYYY
+	 *				DateColor				日期字体颜色0xff 红色  0xff00 绿色  0xffff黄色
+	 *				WeekFormat				星期格式 0.星期X  1.Monday  2.Mon.
+	 *				WeekColor				星期字体颜色0xff 红色  0xff00 绿色  0xffff黄色
+	 *				TimeFormat				时间格式 0.HH时mm分ss秒  1.HH時mm分ss秒  2.HH:mm:ss  3.上午 HH:mm:ss  4.AM HH:mm:ss  5.HH:mm:ss 上午  6.HH:mm:ss AM
+	 *				TimeColor				时间字体颜色0xff 红色  0xff00 绿色  0xffff黄色
+					IsMutleLineShow			0 单行  1多行
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int AddDigitalClockArea(long hProgram,int ProgramNo,int AreaNo,int l,int t,int w,int h,String FontName,int FontSize,int FontColor,int FontBold,int FontItalic,int FontUnderline,int IsYear,int IsWeek,int IsMonth,int IsDay,int IsHour,int IsMinute,int IsSecond,int DateFormat,int DateColor,int WeekFormat,int WeekColor,int TimeFormat,int TimeColor,int IsMutleLineShow);
+
+	/*********************************************************************************************
+	 *	DeleteProgram						销毁节目对象(注意:如果此节目对象不再使用,请调用此函数销毁,否则会造成内存泄露)
+	 *	
+	 *	参数说明
+	 *				hProgram				节目对象句柄
+	 ********************************************************************************************/
+	public native void DeleteProgram(long hProgram);
+	
+	/*********************************************************************************************
+	 *	NetWorkSend							发送节目,此发送为一对一发送
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏IP   /      广域网开发时,指定LED屏网络唯一ID
+	 *				hProgram				节目对象句柄
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int NetWorkSend(String IpStr,long hProgram);
+	
+	/*********************************************************************************************
+	 *	SetBasicInfo						设置基本屏参
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP
+	 *				ColorType				屏的颜色 1.单色  2.双基色  3.三基色
+	 *				GrayLevel				灰度等级, 赋值  1-5对应的灰度等级分别为 无,4,8,16,32
+	 *				LedWidth				屏的宽度点数
+	 *				LedHeight				屏的高度点数
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int SetBasicInfo(String IpStr,int ColorType,int GrayLevel,int LedWidth,int LedHeight);
+	
+	/*********************************************************************************************
+	 *	SetOEDA								设置OE DA
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP
+	 *				Oe						OE  0.低有效  1.高有效
+	 *				Da						DA  0.负极性  1.正极性
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int SetOEDA(String IpStr,int Oe,int Da);
+	
+	/*********************************************************************************************
+	 *	AdjustTime							校时
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int AdjustTime(String IpStr);
+	
+	/*********************************************************************************************
+	 *	PowerOnOff							开关屏
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP
+	 *				OnOff					开关值  0.开屏  1.关屏  2.重启
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int PowerOnOff(String IpStr,int OnOff);
+	
+	/*********************************************************************************************
+	 *	TimePowerOnOff						定时开关屏
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP
+	 *				StartHour				起始小时
+	 *				StartMinute				起始分钟
+	 *				EndHour					结束小时
+	 *				EndMinute				结束分钟
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int TimePowerOnOff(String IpStr,int StartHour,int StartMinute,int EndHour,int EndMinute);
+	
+	/*********************************************************************************************
+	 *	SetBrightness						设置亮度
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP
+	 *				BrightnessValue			亮度值 0~15
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败	
+	 ********************************************************************************************/
+	public native int SetBrightness(String IpStr,int BrightnessValue);
+	
+	/*********************************************************************************************
+	 *	LedTest								LED测试
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP
+	 *				TestValue				测试值
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int LedTest(String IpStr,int TestValue);
+	
+	/*********************************************************************************************
+	 *	SetLedCommunicationParameter		设置LED屏的网络信息
+	 *	
+	 *	参数说明
+	 *				IpStr					LED屏的IP			
+	 *				NewIp					LED屏的新IP
+	 *				NewNetMask				LED屏的新子网掩码
+	 *				NewGateway				LED屏的新网关
+	 *				NewMac					LED屏的新mac地址
+	 *				IsClient				1为启动客户端模式 0为不起动	
+	 *				ServerIp				服务器IP
+	 *				ServerPort				端口
+	 *				IsDHCP					1自动分配 0手动配置
+	 *				IsHeartBeat				1启动心跳包 0不起动心跳包
+	 *				HeartBeatTime				LED心跳包时间
+	 *	返回值
+	 *				0						成功
+	 *				非0						失败
+	 ********************************************************************************************/
+	public native int SetLedCommunicationParameter(String IpStr,String NewIp,String NewNetMask,String NewGateway,String NewMac,int IsClient,String ServerIp,int ServerPort,int IsDHCP,int IsHeartBeat,int HeartBeatTime);
+
+	/*********************************************************************************************
+	*	LedInitServer			启动控制卡心跳包服务
+	*	
+	*	参数说明
+	*				port			监听的端口
+	*	返回值
+	*				0						成功
+	*				非0						失败,调用LV_GetError来获取错误信息	
+	********************************************************************************************/
+	public native int LedInitServer(int port);
+	
+	/*********************************************************************************************
+	*	LedShudownServer			断开控制卡心跳包服务
+	********************************************************************************************/
+	public native int LedShudownServer();
+	
+	/*********************************************************************************************
+	*	RegisterLedServerCallback			注册回调,动态库才会调用LedServerCallback,实时告知上下线控制卡
+	*	cb									回调对象                         
+	********************************************************************************************/
+	//public native static void RegisterLedServerCallback(ledCallBack cb);
+
+	/*********************************************************************************************
+	 *	IdStrList			存储上线控制卡
+	 ********************************************************************************************/
+	public static List<String> IdStrList=new ArrayList<>();
+
+	/*********************************************************************************************
+	 *	LedServerCallback			动态库回调Java方法,实时告知上下线控制卡
+	 ********************************************************************************************/
+	public void LedServerCallback(int Msg, int wParam, String networkIdStr)
+	{
+		switch(Msg){
+			case 1:
+				IdStrList.add(networkIdStr);
+				break;
+			case 2:
+				IdStrList.remove(networkIdStr);
+				break;
+			default :
+				break;
+		}
+
+		for (int i = 0; i < IdStrList.size(); i++) {
+			System.out.println(IdStrList.get(i));
+		}
+	}
+
+	static 
+	{
+		System.loadLibrary("ledplayer7");
+	}
+}

BIN
listenvision/src/main/jniLibs/armeabi-v7a/libledplayer7.so


+ 3 - 0
listenvision/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">listenvision</string>
+</resources>

+ 17 - 0
listenvision/src/test/java/com/listenvision/ExampleUnitTest.java

@@ -0,0 +1,17 @@
+package com.listenvision;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() {
+        assertEquals(4, 2 + 2);
+    }
+}

+ 1 - 1
settings.gradle

@@ -1 +1 @@
-include ':app', ':test', ':nurseMainLib', ':AmDemo_R'
+include ':app', ':test', ':nurseMainLib', ':AmDemo_R', 'listenvision'