From 4cfd0dee1abf5db41b54fb2d4bdd666792b1da72 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期三, 31 一月 2024 10:17:28 +0800 Subject: [PATCH] 2024年01月31日10:17:12 --- app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 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 4704b4d..8497d14 100644 --- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java +++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java @@ -291,18 +291,10 @@ //璁惧鍙栨秷椹卞姩,鍥轰欢涓嬭浇鍗囩骇鏂囦欢 case HDLUniMP.UNI_EVENT_REPLY_OTA_DRIVER_CANCEL_DOWNLOAD: { this.uniCancelDownloadingUpgradeFile(data, callback); -// HdlThreadLogic.runSubThread(new Runnable() { -// @Override -// public void run() { -// HdlLogLogic.print("褰撳墠绾跨▼鍚嶇О鍙栨秷涓嬭浇====" + Thread.currentThread().getName()); -// uniCancelDownloadingUpgradeFile(data, callback); -// } -// }); } break; //璁惧椹卞姩,鍥轰欢鍙栨秷鍗囩骇 case HDLUniMP.UNI_EVENT_REPLY_OTA_CANCEL_UPGRADE: { - this.uniCancelUpgrade(data, callback); } break; @@ -334,6 +326,11 @@ //鑾峰彇浣嶇疆淇℃伅 case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOCATION_INFO: { this.uniGetLocationInfo(data, callback); + } + //涓撻棬鏀堕泦uni鏃ュ織 + case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNI_LOG: { + String customizeContentFormat = getKeyValue("customizeContentFormat", getKeyValue("data", data)); + HdlLogLogic.print("uni--->log--->" + customizeContentFormat, true); } } } @@ -395,7 +392,7 @@ //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) { jsonObject.addProperty("result", -2);//娌℃湁浣嶇疆淇℃伅鏉冮檺 - jsonObject.addProperty("des", "娌℃湁浣嶇疆淇℃伅鏉冮檺"); + jsonObject.addProperty("des", HDLApp.getInstance().getString(R.string.exception_no_location_information_permission)); uniCallbackData(jsonObject.toString(), callback); return; } @@ -403,7 +400,7 @@ // 鍒ゆ柇璁惧鏄惁鏀寔瀹氫綅鍔熻兘 if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { jsonObject.addProperty("result", -1);//娌″紑鍚畾浣嶅姛鑳� - jsonObject.addProperty("des", "娌″紑鍚畾浣嶅姛鑳�"); + jsonObject.addProperty("des", HDLApp.getInstance().getString(R.string.exception_the_location_function_is_not_enabled)); //todo 鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鍔熻兘鎴栬�呭紩瀵肩敤鎴峰幓绯荤粺璁剧疆椤甸潰鎵撳紑瀹氫綅鍔熻兘 uniCallbackData(jsonObject.toString(), callback); return; @@ -411,12 +408,12 @@ Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location == null) { jsonObject.addProperty("result", -3);//娌℃湁浣嶇疆淇℃伅鏉冮檺 - jsonObject.addProperty("des", "娌″紑鍚畾浣嶅姛鑳�"); + jsonObject.addProperty("des", HDLApp.getInstance().getString(R.string.exception_the_location_function_is_not_enabled)); uniCallbackData(jsonObject.toString(), callback); return; } jsonObject.addProperty("result", 0); - jsonObject.addProperty("des", "鎴愬姛"); + jsonObject.addProperty("des", HDLApp.getInstance().getString(R.string.succeed)); jsonObject.addProperty("longitude", location.getLongitude());//缁忓害 jsonObject.addProperty("latitude", location.getLatitude());//绾害 uniCallbackData(jsonObject.toString(), callback); @@ -1206,6 +1203,8 @@ * @param callback uni鍥炶皟 */ private void uniSearchGateway(DCUniMPJSCallback callback) { + + HdlDeviceLogic.getInstance().searchCurrentHomeGateway(new GatewayCallBack() { @Override public void onSuccess(List<GatewayBean> gatewayBeanList) { @@ -1216,6 +1215,7 @@ public void onError(HDLLinkException e) { //鍙戦�佸け璐� uniCallbackData(null, e.getCode(), e.getMsg(), callback); + } }); @@ -1288,22 +1288,24 @@ // modBusBean.setOid("0101050217BBC400"); // } if (modBusBean.getMac() == null || modBusBean.getData() == null) { - HdlLogLogic.print("鍐呭涓虹┖--->oid--->" + modBusBean.getMac() + " data--->" + Arrays.toString(modBusBean.getData()), false); + HdlLogLogic.print("uni--->鍙戦��--->ModBus--->鍙戦�佸け璐�,(mac鎴栬�卭id)涓虹┖." + Arrays.toString(modBusBean.getData()), true); return; } - + HdlLogLogic.print("uni--->鍙戦��--->ModBus--->" + Arrays.toString(modBusBean.getData()), true); //鍙戦�乵odbus鍗忚 HDLModBusConnect.getInstance().Send(modBusBean.getMac(), modBusBean.getData(), new ModbusCallBack() { @Override public void onSuccess(int[] data) { - Log.d("data", Arrays.toString(data)); uniCallbackData(data, callback); + HdlLogLogic.print("uni--->鎺ユ敹--->ModBus--->" + Arrays.toString(data), true); + } @Override public void onError(HDLLinkException e) { uniCallbackData(null, e.getCode(), e.getMsg(), callback); + HdlLogLogic.print("uni--->寮傚父--->ModBus--->" + e.getMsg() + "(" + e.getCode() + ")", true); } }); } -- Gitblit v1.8.0