From 788c70114287306db20e9a4539018d6e32fb5cb7 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 19 四月 2024 10:10:10 +0800
Subject: [PATCH] Merge branch 'wjc_new' into develop_new
---
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 33 +++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 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 8b43056..467ca14 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -43,6 +43,7 @@
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.LinkBean;
import com.hdl.photovoltaic.ui.bean.OidBean;
import com.hdl.photovoltaic.ui.me.AsRegardsActivity;
import com.hdl.photovoltaic.ui.me.PersonalDataActivity;
@@ -58,10 +59,12 @@
import com.hdl.sdk.link.common.exception.HDLLinkException;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
+import com.hdl.sdk.link.core.bean.response.BaseLocalResponse;
import com.hdl.sdk.link.core.callback.GatewayCallBack;
import com.hdl.sdk.link.core.callback.HDLLinkCallBack;
import com.hdl.sdk.link.core.callback.ModbusCallBack;
import com.hdl.sdk.link.core.connect.HDLModBusConnect;
+import com.hdl.sdk.link.core.connect.HDLUdpConnect;
import com.hdl.sdk.link.gateway.HDLLinkLocalGateway;
import org.greenrobot.eventbus.EventBus;
@@ -389,6 +392,13 @@
//鑾峰彇浣嶇疆淇℃伅
case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOCATION_INFO: {
this.uniGetLocationInfo(mode_type, data, callback);
+ }
+ break;
+ //搴旂敤鍐茬獊
+ case HDLUniMP.UNI_EVENT_REPLY_OTHER_APPLICATION_CONFLICT: {
+ if (callback != null) {
+ uniCallbackData(type, HDLUdpConnect.getInstance().isBindSuccess(), callback);
+ }
}
break;
//涓撻棬鏀堕泦uni鏃ュ織
@@ -1266,7 +1276,7 @@
GatewayBean gatewayBean = new GatewayBean();
gatewayBean.setDevice_mac(mac);
list.add(gatewayBean);
- HdlDeviceLogic.getInstance().uploadDataToCloud(UserConfigManage.getInstance().getHomeId(), list, null);
+ HdlDeviceLogic.getInstance().uploadOidDataToCloud(UserConfigManage.getInstance().getHomeId(), list, true, null);
}
/**
@@ -1399,7 +1409,7 @@
// com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(data);
try {
String devices = getKeyValue("devices", getKeyValue("data", data));
- String homeId = UserConfigManage.getInstance().getHomeId(); //getKeyValue("homeId", getKeyValue("data", data));
+ String homeId = UserConfigManage.getInstance().getHomeId(); //缁戝畾鎴愬姛涔嬪悗閫氱煡
Gson gson = new Gson();
Type typeOfT = new TypeToken<List<GatewayBean>>() {
}.getType();
@@ -1532,7 +1542,7 @@
baseEventBus.setData(list);
EventBus.getDefault().post(baseEventBus);
//杩涙潵浣忓畢璇︽儏閮借涓婁紶涓�娆id鍒楄〃鍒颁簯绔�;
- HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, list, null);
+ HdlDeviceLogic.getInstance().uploadOidDataToCloud(homeId, list, false, null);
}
@Override
@@ -1587,7 +1597,6 @@
String mac = getKeyValue("mac", getKeyValue("data", data));
String attribute_data = getKeyValue("attribute_data", getKeyValue("data", data));
JsonArray jay = new JsonArray();
-//{"id":"c2d8b26b-3371-4fed-a190-78da31b454cf","time_stamp":"1711531144489","objects":[{"sid":"010126005C000251333036333237"}]}
if (!TextUtils.isEmpty(attribute_data)) {
try {
Gson gson = new Gson();
@@ -1601,7 +1610,15 @@
TcpClient.getInstance().sendDataToLinkGateway(mac, TopicApi.PROPERTY_READ, jay, "", new HDLLinkCallBack() {
@Override
public void onSuccess(String msg) {
- uniCallbackData(type, msg, callback);
+ try {
+ Gson gson = new Gson();
+ Type typeOfT = new TypeToken<BaseLocalResponse<List<LinkBean>>>() {
+ }.getType();
+ BaseLocalResponse<List<LinkBean>> baseLocalResponse = gson.fromJson(msg, typeOfT);
+ uniCallbackData(type, baseLocalResponse, callback);
+ } catch (Exception e) {
+ uniCallbackData(type, msg, -2, "", callback);
+ }
}
@Override
@@ -1682,7 +1699,7 @@
data = new JSONObject();
}
if (isTokenAndRefreshToken) {
- //灏忕▼搴忛偅閲屾湁鑷繁鐨勮姹傛柟娉�,闇�瑕佽繖浜涙暟鎹�
+ //灏忕▼搴忛偅閲屾湁鑷繁鐨勮姹傛柟娉�,浣嗛渶瑕佸師鐢熸彁渚涜繖浜涙暟鎹�
data.put("token", UserConfigManage.getInstance().getToken());
data.put("refreshToken", UserConfigManage.getInstance().getRefreshToken());
if (TextUtils.isEmpty(AppConfigManage.getUserRegionUrl())) {
@@ -1720,10 +1737,10 @@
if (callback != null) {
callback.invoke(getJSONObject(uniCallBackBaseBean));
// callback.invoke(uniCallBackBaseBean);
- HdlLogLogic.print("uni--->鎺ユ敹--->" + type + "--->" + new Gson().toJson(uniCallBackBaseBean), true);
+ HdlLogLogic.print("uni--->鍥炲--->" + type + "--->" + new Gson().toJson(uniCallBackBaseBean), true);
}
} catch (Exception e) {
- HdlLogLogic.print("uni--->鎺ユ敹--->" + type + "--->" + e.getMessage(), true);
+ HdlLogLogic.print("uni--->鍥炲--->" + type + "--->" + e.getMessage(), true);
}
--
Gitblit v1.8.0