From a0e8f81afc4fe2a21a5c504d53e569ea50d463d6 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 15 三月 2024 11:51:23 +0800
Subject: [PATCH] 2024年03月15日11:51:17

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java |  357 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 303 insertions(+), 54 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 6720846..98eeaef 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -8,18 +8,17 @@
 import android.content.ServiceConnection;
 import android.content.pm.PackageManager;
 import android.location.Location;
-import android.location.LocationListener;
 import android.location.LocationManager;
 import android.os.IBinder;
-import android.provider.Settings;
 import android.text.TextUtils;
-import android.util.Log;
+import android.view.View;
+import android.widget.TextView;
 
-import androidx.annotation.NonNull;
 import androidx.core.app.ActivityCompat;
 
+import com.alibaba.fastjson.JSON;
 import com.google.gson.Gson;
-import com.google.gson.JsonObject;
+import com.google.gson.reflect.TypeToken;
 import com.hdl.linkpm.sdk.core.exception.HDLException;
 import com.hdl.linkpm.sdk.device.bean.DeviceOidInfoBean;
 import com.hdl.linkpm.sdk.ota.bean.CloudDeviceFirmwaresBean;
@@ -35,10 +34,16 @@
 import com.hdl.photovoltaic.internet.HttpServer.MyNanoHttpServer;
 import com.hdl.photovoltaic.listener.CloudCallBeak;
 import com.hdl.photovoltaic.listener.LinkCallBack;
+import com.hdl.photovoltaic.ui.bean.CUserInfo;
 import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean;
 import com.hdl.photovoltaic.ui.bean.DeviceTimeBean;
 import com.hdl.photovoltaic.ui.bean.Geolocation;
 import com.hdl.photovoltaic.ui.bean.OidBean;
+import com.hdl.photovoltaic.ui.me.AsRegardsActivity;
+import com.hdl.photovoltaic.ui.me.PersonalDataActivity;
+import com.hdl.photovoltaic.ui.me.SetActivity;
+import com.hdl.photovoltaic.ui.newC.MessageCenterList;
+import com.hdl.photovoltaic.ui.newC.PowerStationsListEdit;
 import com.hdl.photovoltaic.uni.HDLUniMP;
 import com.hdl.photovoltaic.uni.HDLUniMPSDKManager;
 import com.hdl.photovoltaic.utils.NetworkUtils;
@@ -58,10 +63,14 @@
 
 
 import java.io.File;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import io.dcloud.feature.unimp.DCUniMPJSCallback;
 import okhttp3.ResponseBody;
@@ -107,8 +116,25 @@
                 return;
             }
             String type = getKeyValue("type", data);//灏忕被
-            String mode_type = "澶х被->" + topic + "--->灏忕被->" + type;//鐢ㄦ潵鎵撳嵃鐨�
-            if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(topic)) {
+            String logTag = getKeyValue("logTag", data);//鏍囪uni鎸囦护
+            String mode_type = "澶х被->" + topic + "--->" + "灏忕被->" + type;//鐢ㄦ潵鎵撳嵃鐨�
+            HdlLogLogic.print(logTag + ":" + "uni--->鍙戦��--->" + mode_type + "\r\n" + data, true);
+            if (HDLUniMP.UNI_EVENT_REPLY_USER_MODEL.equals(topic)) {
+                //鐢ㄦ埛妯″潡
+                switch (type) {
+                    //鐢ㄦ埛淇℃伅
+                    case HDLUniMP.UNI_EVENT_REPLY_USER_INFO: {
+                        this.uniGetUserInfo(mode_type, data, callback);
+                    }
+                    break;
+                    //鐢ㄦ埛澶村儚锛堟棫骞冲彴閫昏緫鏄ご鍍忓崟鐙幏鍙栦笅杞藉湴鍧�锛�
+                    case HDLUniMP.UNI_EVENT_REPLY_USER_IMAGE: {
+                        uniGetImageKey(mode_type, data, callback);
+                    }
+                    break;
+                }
+
+            } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(topic)) {
                 //浣忓畢妯″潡
                 switch (type) {
                     //鍒涘缓鐢电珯
@@ -157,6 +183,11 @@
                     case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ADD: {
                         this.uniAddInverterDeviceToCloud(mode_type, data, callback);
                     }
+                    //娣诲姞澶氫釜閫嗗彉鍣ㄥ埌浜戠
+                    case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ADD_All: {
+                        this.uniAddAllInverterDeviceToCloud(mode_type, data, callback);
+                    }
+
                     break;
                     //鍒犻櫎浜戠閫嗗彉鍣�
                     case HDLUniMP.UNI_EVENT_REPLY_DEVICE_DEL: {
@@ -202,6 +233,11 @@
                     //閫嗗彉鍣ㄦ竻绌轰綇瀹卛d
                     case HDLUniMP.UNI_EVENT_REPLY_DEVICE_CLEAR_DATA: {
                         this.uniClearInverterHomeId(mode_type, data, callback);
+                    }
+                    break;
+                    //鑾峰彇鏈鐞�/鏈娑堟伅鏁伴噺
+                    case HDLUniMP.UNI_EVENT_REPLY_DEVICE_MESSAGE_NUMBER: {
+                        this.uniGetMessageNumber(mode_type, data, callback);
                     }
                     break;
 
@@ -313,7 +349,6 @@
 
                 }
             } else if (HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL.equals(topic)) {
-
                 //鍏跺畠妯″潡
                 switch (type) {
                     //鑾峰彇娓╁害鍗曚綅
@@ -336,8 +371,54 @@
                         HdlLogLogic.print("uni--->log--->" + customizeContentFormat, true);
                     }
                 }
+            } else if (HDLUniMP.UNI_EVENT_REPLY_MINE_MODEL.equals(topic)) {
+                //鎴戠殑妯″潡
+                switch (type) {
+                    //璧勬枡缂栬緫
+                    case HDLUniMP.UNI_EVENT_REPLY_MINE_EDIT_USER_INFO: {
+                        Intent intent = new Intent();
+                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                        intent.setClass(HDLApp.getInstance(), PersonalDataActivity.class);
+                        HDLApp.getInstance().startActivity(intent);
+                    }
+                    break;
+                    //鐢电珯閫夋嫨
+                    case HDLUniMP.UNI_EVENT_REPLY_MINE_SELECTED_POWERSTATION: {
+                        Intent intent = new Intent();
+                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                        intent.setClass(HDLApp.getInstance(), PowerStationsListEdit.class);
+                        HDLApp.getInstance().startActivity(intent);
+                    }
+                    break;
+                    //娑堟伅涓績
+                    case HDLUniMP.UNI_EVENT_REPLY_MINE_MESSAGE_CENTER: {
+                        Intent intent = new Intent();
+                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                        intent.setClass(HDLApp.getInstance(), MessageCenterList.class);
+                        HDLApp.getInstance().startActivity(intent);
+                    }
+                    break;
+                    //鍏充簬
+                    case HDLUniMP.UNI_EVENT_REPLY_MINE_ABOUT: {
+                        Intent intent = new Intent();
+                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                        intent.setClass(HDLApp.getInstance(), AsRegardsActivity.class);
+                        HDLApp.getInstance().startActivity(intent);
+                    }
+                    break;
+                    //璁剧疆
+                    case HDLUniMP.UNI_EVENT_REPLY_MINE_SETTING: {
+                        Intent intent = new Intent();
+                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                        intent.setClass(HDLApp.getInstance(), SetActivity.class);
+                        HDLApp.getInstance().startActivity(intent);
+                    }
+                    break;
+
+
+                }
             }
-            HdlLogLogic.print("uni--->鍙戦��--->" + mode_type + "\r\n" + data, true);
+
         } catch (Exception e) {
             HdlLogLogic.print("uni--->鍙戦��--->" + e.getMessage(), true);
         }
@@ -386,42 +467,49 @@
      * 鑾峰彇浣嶇疆淇℃伅,鍖呮嫭缁忕含搴�
      */
     private void uniGetLocationInfo(String type, Object data, DCUniMPJSCallback callback) {
-
-
-        // 鍒濆鍖朙ocationManager瀵硅薄
-        LocationManager locationManager = (LocationManager) HDLApp.getInstance().getSystemService(Context.LOCATION_SERVICE);
-        Geolocation geolocation = new Geolocation();
-        //INTERNET	鍏佽浣跨敤缃戠粶
-        //ACCESS_FINE_LOCATION	鍏佽浣跨敤GPS瀹氫綅
-        //ACCESS_COARSE_LOCATION	鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣�
-        if (ActivityCompat.checkSelfPermission(HDLApp.getInstance(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(HDLApp.getInstance(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
-            geolocation.setResult(-2);
-            geolocation.setDes(HDLApp.getInstance().getString(R.string.exception_no_location_information_permission));
+        try {
+            // 鍒濆鍖朙ocationManager瀵硅薄
+            LocationManager locationManager = (LocationManager) HDLApp.getInstance().getSystemService(Context.LOCATION_SERVICE);
+            Geolocation geolocation = new Geolocation();
+            //INTERNET	鍏佽浣跨敤缃戠粶
+            //ACCESS_FINE_LOCATION	鍏佽浣跨敤GPS瀹氫綅
+            //ACCESS_COARSE_LOCATION	鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣�
+            if (ActivityCompat.checkSelfPermission(HDLApp.getInstance(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(HDLApp.getInstance(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+                geolocation.setResult(-2);
+                geolocation.setDes(HDLApp.getInstance().getString(R.string.exception_no_location_information_permission));
+                uniCallbackData(type, geolocation, callback);
+                return;
+            }
+            // 鍒ゆ柇璁惧鏄惁鏀寔瀹氫綅鍔熻兘
+            if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
+                geolocation.setResult(-1);
+                geolocation.setDes(HDLApp.getInstance().getString(R.string.exception_the_location_function_is_not_enabled));
+                //todo 鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鍔熻兘鎴栬�呭紩瀵肩敤鎴峰幓绯荤粺璁剧疆椤甸潰鎵撳紑瀹氫綅鍔熻兘
+                uniCallbackData(type, geolocation, callback);
+                return;
+            }
+            Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
+            if (location == null) {
+                geolocation.setResult(-3);
+                geolocation.setDes(HDLApp.getInstance().getString(R.string.exception_unable_location_move10_meters_later));
+                uniCallbackData(type, geolocation, callback);
+                return;
+            }
+            geolocation.setResult(0);
+            geolocation.setDes(HDLApp.getInstance().getString(R.string.succeed));
+            BigDecimal latitude = BigDecimal.valueOf(location.getLatitude());//缁忓害
+            BigDecimal longitude = BigDecimal.valueOf(location.getLongitude());//绾害
+            double lat = latitude.setScale(6, RoundingMode.HALF_DOWN).doubleValue();
+            double lon = longitude.setScale(6, RoundingMode.HALF_DOWN).doubleValue();
+            geolocation.setLatitude(lat);//缁忓害
+            geolocation.setLongitude(lon);//绾害
             uniCallbackData(type, geolocation, callback);
-            return;
-        }
-        // 鍒ゆ柇璁惧鏄惁鏀寔瀹氫綅鍔熻兘
-        if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
-            geolocation.setResult(-1);
-            geolocation.setDes(HDLApp.getInstance().getString(R.string.exception_the_location_function_is_not_enabled));
-            //todo 鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鍔熻兘鎴栬�呭紩瀵肩敤鎴峰幓绯荤粺璁剧疆椤甸潰鎵撳紑瀹氫綅鍔熻兘
+        } catch (Exception e) {
+            Geolocation geolocation = new Geolocation();
+            geolocation.setResult(-4);
+            geolocation.setDes(e.getMessage());
             uniCallbackData(type, geolocation, callback);
-            return;
         }
-        Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
-        if (location == null) {
-            geolocation.setResult(-3);
-            geolocation.setDes(HDLApp.getInstance().getString(R.string.exception_the_location_function_is_not_enabled));
-            uniCallbackData(type, geolocation, callback);
-            return;
-        }
-        geolocation.setResult(0);
-        geolocation.setDes(HDLApp.getInstance().getString(R.string.succeed));
-        geolocation.setLongitude(location.getLatitude());//绾害
-        geolocation.setLatitude(location.getLongitude());//缁忓害
-        uniCallbackData(type, geolocation, callback);
-        HdlLogLogic.print("缁忕含搴�--->缁忓害:" + location.getLongitude() + "绾害:" + location.getLatitude(), true);
-
     }
 
     /**
@@ -1019,6 +1107,72 @@
     }
 
     /**
+     * 鑾峰彇鐢ㄦ埛淇℃伅
+     *
+     * @param data     uni鏁版嵁
+     * @param callback uni鍥炶皟
+     */
+    private void uniGetUserInfo(String type, Object data, DCUniMPJSCallback callback) {
+        HdlAccountLogic.getInstance().getMemberInfo_C(new CloudCallBeak<CUserInfo>() {
+            @Override
+            public void onSuccess(CUserInfo cUserInfo) {
+                if (cUserInfo == null) {
+                    return;
+                }
+                UserConfigManage.getInstance().setBingPhone(cUserInfo.getMemberPhone());
+                UserConfigManage.getInstance().setBingEmail(cUserInfo.getMemberEmail());
+                UserConfigManage.getInstance().Save();
+                //鑾峰彇鐢ㄦ埛澶村儚璺緞
+                if (cUserInfo.getMemberHeadIcon().contains("http")) {
+                    //鏇存柊鐢ㄦ埛澶村儚
+                    uniCallbackData(type, cUserInfo, callback);
+                } else {
+                    HdlAccountLogic.getInstance().getImageKey_C(cUserInfo.getMemberHeadIcon(), new CloudCallBeak<String>() {
+                        @Override
+                        public void onSuccess(String url) {
+                            cUserInfo.setMemberHeadIcon(url);
+                            uniCallbackData(type, cUserInfo, callback);
+                        }
+
+                        @Override
+                        public void onFailure(HDLException e) {
+                            uniCallbackData(type, cUserInfo, callback);
+                        }
+                    });
+                }
+
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+            }
+        });
+    }
+
+    /**
+     * 鑾峰彇鐢ㄦ埛澶村儚
+     *
+     * @param data     uni鏁版嵁
+     * @param callback uni鍥炶皟
+     */
+    private void uniGetImageKey(String type, Object data, DCUniMPJSCallback callback) {
+        String imageKey = getKeyValue("imageKey", getKeyValue("data", data));
+        HdlAccountLogic.getInstance().getImageKey_C(imageKey, new CloudCallBeak<String>() {
+            @Override
+            public void onSuccess(String url) {
+                uniCallbackData(type, url, callback);
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+            }
+        });
+    }
+
+
+    /**
      * 閫嗗彉鍣ㄦ竻绌轰綇瀹卛d
      *
      * @param data     uni鏁版嵁
@@ -1040,6 +1194,27 @@
     }
 
     /**
+     * 鑾峰彇鏈鐞�/鏈娑堟伅鏁伴噺
+     *
+     * @param data     uni鏁版嵁
+     * @param callback uni鍥炶皟
+     */
+    private void uniGetMessageNumber(String type, Object data, DCUniMPJSCallback callback) {
+        String homeId = getKeyValue("homeId", getKeyValue("data", data));
+        HdlMessageLogic.getInstance().getMessageUntreatedCount(homeId, new CloudCallBeak<String>() {
+            @Override
+            public void onSuccess(String data) {
+                uniCallbackData(type, data, callback);
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+            }
+        });
+    }
+
+    /**
      * 閫嗗彉鍣ㄣ�愪笂浼犳暟鎹�戝埌浜戠
      *
      * @param data     uni鏁版嵁
@@ -1047,7 +1222,11 @@
      */
     private void uniUploadDataToCloud(String type, Object data, DCUniMPJSCallback callback) {
         String mac = getKeyValue("mac", getKeyValue("data", data));
-        HdlDeviceLogic.getInstance().uploadDataToCloud(UserConfigManage.getInstance().getHomeId(), mac, null);
+        List<GatewayBean> list = new ArrayList<>();
+        GatewayBean gatewayBean = new GatewayBean();
+        gatewayBean.setDevice_mac(mac);
+        list.add(gatewayBean);
+        HdlDeviceLogic.getInstance().uploadDataToCloud(UserConfigManage.getInstance().getHomeId(), list, null);
     }
 
     /**
@@ -1121,6 +1300,7 @@
 
     }
 
+
     /**
      * 閫嗗彉鍣ㄦ坊鍔犲埌浜戠涓�
      *
@@ -1170,6 +1350,77 @@
     }
 
     /**
+     * 澶氫釜閫嗗彉鍣ㄦ坊鍔犲埌浜戠涓�
+     *
+     * @param data     uni鏁版嵁
+     * @param callback uni鍥炶皟
+     */
+    private void uniAddAllInverterDeviceToCloud(String type, Object data, DCUniMPJSCallback callback) {
+//        com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(data);
+        try {
+            String devices = getKeyValue("devices", getKeyValue("data", data));
+            Gson gson = new Gson();
+            Type typeOfT = new TypeToken<List<GatewayBean>>() {
+            }.getType();
+            List<GatewayBean> list = gson.fromJson(devices, typeOfT);
+            if (list == null || list.size() == 0) {
+                uniCallbackData(type, null, -100, HDLApp.getInstance().getString(R.string.The_gateway_cannot_be_found_locally), callback);
+                return;
+            }
+            String homeId = UserConfigManage.getInstance().getHomeId();
+            //璁板綍鏉℃暟
+            AtomicInteger atomicInteger = new AtomicInteger(0);
+            final boolean[] is_boolean = {false};
+            for (int i = 0; i < list.size(); i++) {
+                GatewayBean gatewayBean = list.get(i);
+                HdlDeviceLogic.getInstance().setGatewayRemoteParam(homeId, gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
+                    @Override
+                    public void onSuccess(Boolean obj) {
+                        HdlDeviceLogic.getInstance().editGatewayParam(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
+                            @Override
+                            public void onSuccess(Boolean obj) {
+                                atomicInteger.set(atomicInteger.get() + 1);
+                                //鏈�鍚庝竴鏉℃墠鍋氭坊鍔犻�嗗彉鍣ㄩ�昏緫澶勭悊
+                                if (atomicInteger.get() == list.size()) {
+                                    HdlDeviceLogic.getInstance().addAllInverterDeviceToCloud(homeId, list, new CloudCallBeak<Boolean>() {
+                                        @Override
+                                        public void onSuccess(Boolean obj) {
+                                            uniCallbackData(type, null, callback);
+                                        }
+
+                                        @Override
+                                        public void onFailure(HDLException e) {
+                                            uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+                                        }
+                                    });
+                                }
+
+                            }
+
+                            @Override
+                            public void onError(HDLLinkException e) {
+                                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+                                is_boolean[0] = true;
+                            }
+                        });
+                    }
+
+                    @Override
+                    public void onError(HDLLinkException e) {
+                        uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
+                        is_boolean[0] = true;
+                    }
+                });
+                if (is_boolean[0]) {
+                    //鍙湁涓棿鏈変竴鏉℃寚浠よ缃け璐�,榛樿鍏ㄩ儴澶辫触;
+                    break;
+                }
+            }
+        } catch (Exception ignored) {
+        }
+    }
+
+    /**
      * 鍒犻櫎浜戠涓婇�嗗彉鍣�
      *
      * @param data     uni鏁版嵁
@@ -1200,7 +1451,7 @@
     private void uniSearchGateway(String type, DCUniMPJSCallback callback) {
 
 
-        HdlDeviceLogic.getInstance().searchCurrentHomeGateway(new GatewayCallBack() {
+        HdlDeviceLogic.getInstance().searchAllNetworkGateway(new GatewayCallBack() {
             @Override
             public void onSuccess(List<GatewayBean> gatewayBeanList) {
                 uniCallbackData(type, gatewayBeanList, callback);
@@ -1232,11 +1483,8 @@
                     }
                     return;
                 }
-                GatewayBean gatewayBean = HdlDeviceLogic.getInstance().queryCurrentHomeMainGateway(list, homeId);
-                if (gatewayBean != null) {
-                    //杩涙潵浣忓畢璇︽儏閮借涓婁紶涓�娆id鍒楄〃鍒颁簯绔�;
-                    HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, gatewayBean.getDevice_mac(), null);
-                }
+                //杩涙潵浣忓畢璇︽儏閮借涓婁紶涓�娆id鍒楄〃鍒颁簯绔�;
+                HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, list, null);
                 //EventBus浜嬩欢鍒嗗彂,杩涘叆浣忓畢寮�濮嬭闃呬富棰�
                 BaseEventBus baseEventBus = new BaseEventBus();
                 baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST);
@@ -1275,7 +1523,8 @@
     private void sendModBus(String type, Object data, DCUniMPJSCallback callback) {
         String tempData = getKeyValue("data", data);
         if (TextUtils.isEmpty(tempData)) {
-            HdlLogLogic.print("data鍐呭涓虹┖--->", false);
+            uniCallbackData(type, null, -2, "data鍐呭涓虹┖", callback);
+            //HdlLogLogic.print("data鍐呭涓虹┖--->", false);
             return;
         }
         ModBusBean modBusBean = new Gson().fromJson(tempData, ModBusBean.class);
@@ -1286,11 +1535,12 @@
 //            modBusBean.setOid("0101050217BBC400");
 //        }
         if (modBusBean.getMac() == null || modBusBean.getData() == null) {
-            HdlLogLogic.print("uni--->鍙戦��--->ModBus--->鍙戦�佸け璐�,(mac鎴栬�卭id)涓虹┖." + Arrays.toString(modBusBean.getData()), true);
+            uniCallbackData(type, null, -2, "鍙戦�佸け璐�,(mac鎴栬�卭id)涓虹┖", callback);
+            //HdlLogLogic.print("uni--->鍙戦��--->ModBus--->鍙戦�佸け璐�,(mac鎴栬�卭id)涓虹┖." + Arrays.toString(modBusBean.getData()), true);
             return;
         }
 
-        HdlLogLogic.print("uni--->鍙戦��--->ModBus--->" + Arrays.toString(modBusBean.getData()), true);
+        //HdlLogLogic.print("uni--->鍙戦��--->ModBus--->" + Arrays.toString(modBusBean.getData()), true);
         //鍙戦�乵odbus鍗忚
         HDLModBusConnect.getInstance().Send(modBusBean.getMac(), modBusBean.getData(), new ModbusCallBack() {
             @Override
@@ -1362,10 +1612,9 @@
                 callback.invoke(getJSONObject(uniCallBackBaseBean));
 //                callback.invoke(uniCallBackBaseBean);
                 HdlLogLogic.print("uni--->鎺ユ敹--->" + type + "--->" + new Gson().toJson(uniCallBackBaseBean), true);
-
             }
         } catch (Exception e) {
-            HdlLogLogic.print("uni--->鎺ユ敹--->" + type + "--->" + e.getMessage(), false);
+            HdlLogLogic.print("uni--->鎺ユ敹--->" + type + "--->" + e.getMessage(), true);
         }
 
 

--
Gitblit v1.8.0