From 1402cca44aae4eef9509ea6051ace918e635d23f Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 24 四月 2025 17:47:20 +0800 Subject: [PATCH] 2025年04月24日17:47:15 --- app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java | 72 +++++++++++++++++++++--------------- 1 files changed, 42 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java index 082b650..b2db396 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java @@ -5,7 +5,6 @@ import android.os.Process; import android.os.SystemClock; import android.text.TextUtils; -import android.util.Log; import com.google.gson.Gson; @@ -20,11 +19,10 @@ import com.hdl.photovoltaic.config.ConstantManage; import com.hdl.photovoltaic.config.UserConfigManage; import com.hdl.photovoltaic.databinding.ActivityCpowerStationBinding; -import com.hdl.photovoltaic.enums.LowerTagType; import com.hdl.photovoltaic.enums.NetworkType; import com.hdl.photovoltaic.listener.CloudCallBeak; -import com.hdl.photovoltaic.other.HdlCommonLogic; import com.hdl.photovoltaic.other.HdlDeviceLogic; +import com.hdl.photovoltaic.other.HdlESLocalJsonLogic; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlMqttLogic; import com.hdl.photovoltaic.other.HdlOtaLogic; @@ -45,15 +43,12 @@ import com.hdl.sdk.link.core.bean.gateway.GatewayBean; import com.hdl.sdk.link.core.config.HDLLinkConfig; import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient; +import com.umeng.analytics.MobclickAgent; -import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import cn.jpush.android.api.JPushInterface; @@ -76,9 +71,8 @@ @Override public void onBindView(Bundle savedInstanceState) { -// setNotificationBarBackgroundColor(CustomColor.white); - getWindow().setStatusBarColor(getColor(R.color.text_FFFFFFFF)); - setStatusBarTextColor(); + setStatusBarTranslucent(); + getWindow().setNavigationBarColor(getColor(R.color.text_FF000000)); //C绔惎鍔ˋpp鑷姩鎵撳紑灏忕▼搴忕數绔欒鎯呯晫闈� startAppAutomaticallyOpenUni(); //娉ㄥ唽鐩戝惉 @@ -87,6 +81,8 @@ this.initMqttClient(); //涓婁紶鏋佸厜娉ㄥ唽ID鍒颁簯绔� this.pushTokens(); + //鑾峰彇浜戠鑴氭湰 + HdlESLocalJsonLogic.getInstance().getAllHdlESLocalJson(); } @Override @@ -105,12 +101,13 @@ runOnUiThread(new Runnable() { @Override public void run() { - //浣庝簬瀹夊崜14鐗堟湰 - if (android.os.Build.VERSION.SDK_INT < 34) { - startAppAutomaticallyOpenUni(false); - } else { - startAppAutomaticallyOpenUni(true); - } + startAppAutomaticallyOpenUni(false); +// //浣庝簬瀹夊崜14鐗堟湰 +// if (android.os.Build.VERSION.SDK_INT < 34) { +// startAppAutomaticallyOpenUni(false); +// } else { +// startAppAutomaticallyOpenUni(false); +// } } }); } @@ -134,7 +131,7 @@ return; } int index = -1; - List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()); + List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId(), null); for (int i = 0; i < list.size(); i++) { GatewayBean gatewayBean = list.get(i); if (gatewayBean.getGatewayId().equals(topics[2])) { @@ -172,7 +169,7 @@ HdlLogLogic.print(event.getTopic() + new Gson().toJson(event.getData()), true); } else if (event.getTopic().contains(ConstantManage.network_change_post)) { // String wifi_ssid = WifiUtils.getInstance().getCurrentConnectWifiSsid();//鑾峰彇WiFi鐨剆sid闇�瑕佷綅缃潈闄愮殑 - HdlLogLogic.print("鐩戝惉缃戠粶鐘舵��--->" + event.getData().toString() + "(" + event.getType() + ")", true); + HdlLogLogic.print("鐩戝惉缃戠粶鐘舵��---" + event.getData().toString() + "(" + event.getType() + ")", true); //绗竴娆″惎鍔ˋpp,浠ュ強鍒囨崲缃戠粶鐨勬椂鍊欐洿鏂� if (TextUtils.isEmpty(UserConfigManage.getInstance().getHomeId())) { return; @@ -208,8 +205,8 @@ } String homeId = event.getData().toString(); //杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡 - for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) { - String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId(); + for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).size(); i++) { + String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).get(i).getGatewayId(); //瀛楃涓叉槸鑷繁鎸夎鍒欐嫾鎺ョ殑,閲岄潰娉ㄥ唽涓婚鏃朵細瑙f瀽瀛楃涓�,鍙嬁getGatewayId()鍊�; String topic = "/user/" + gatewayId + "/#"; //杩涘幓浣忓畢璇︽儏寮�濮嬭闃呬富棰� @@ -229,15 +226,17 @@ */ private void startAppAutomaticallyOpenUni(boolean delay) { - if (delay) { - SystemClock.sleep(2000); - } +// if (delay) { +// SystemClock.sleep(2000); +// } if (TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) { //鍏跺疄鍒锋柊token澶辫触宸查�氱煡閫�鍑虹櫥褰曪紝鏁版嵁宸茬粡娓呯┖锛屽洜涓虹瓑2s uni鍔犺浇鎱㈠鑷磋姹傞摼鎺ョ殑鏃跺�欏嚭鐜皌oken涓虹┖ + HdlLogLogic.print("杩斿洖鍘�"); return; } + UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(0); List<HouseIdBean> HouseIdList = HdlResidenceLogic.getInstance().getHouseIdList(); - if (HouseIdList.size() == 0) { + if (HouseIdList.isEmpty()) { if (TextUtils.isEmpty(UserConfigManage.getInstance().getHomeId())) { String path = HDLUniMP.UNI_EVENT_OPEN_HOME_Null_C; HdlUniLogic.getInstance().openUniMP(path, null); @@ -255,7 +254,7 @@ } } HouseIdBean houseIdBean = HouseIdList.get(select_home); - HdlResidenceLogic.getInstance().switchHouse(houseIdBean); + HdlResidenceLogic.getInstance().switchHouse(houseIdBean, false); String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); HdlUniLogic.getInstance().openUniMP(path, null); } @@ -295,6 +294,8 @@ HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP(); } AppManagerUtils.getAppManager().finishAllActivity(); + //濡傛灉寮�鍙戣�呰皟鐢╧ill鎴栬�卐xit涔嬬被鐨勬柟娉曟潃姝昏繘绋嬶紝鎴栬�呭弻鍑籦ack閿細鏉�姝昏繘绋嬶紝璇峰姟蹇呭湪姝や箣鍓嶈皟鐢∕obclickAgent.onKillProcess鏂规硶锛岀敤鏉ヤ繚瀛樼粺璁℃暟鎹�� + MobclickAgent.onKillProcess(_mActivity); Process.killProcess(Process.myPid()); } } @@ -347,14 +348,14 @@ UserConfigManage.getInstance().Save(); } HDLApp.getInstance().setInfoMap(registrationId_tag, "true");//璁板綍涓�涓嬬姸鎬�,鍚庡彴鏉�姝籥pp浼氭竻绌�; - HdlLogLogic.print("C绔�--->娣诲姞鏋佸厜ID鍒颁簯绔�--->registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); + HdlLogLogic.print("C绔�---娣诲姞鏋佸厜ID鍒颁簯绔�---registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); } @Override public void onFailure(HDLException e) { HDLApp.getInstance().setInfoMap(registrationId_tag, "false");//璁板綍涓�涓嬬姸鎬�,鍚庡彴鏉�姝籥pp浼氭竻绌�; - HdlLogLogic.print("C绔�--->娣诲姞鏋佸厜ID鍒颁簯绔け璐�--->registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); + HdlLogLogic.print("C绔�---娣诲姞鏋佸厜ID鍒颁簯绔け璐�---registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); } }); @@ -380,13 +381,13 @@ if (info != null) { MqttRecvClient.getInstance().setConnectParam(info.getUrl(), info.getClientId(), info.getUserName(), info.getPassWord()); MqttRecvClient.getInstance().connect(); - HdlLogLogic.print("mqtt閾炬帴鎴愬姛--->ClientId--->" + info.getClientId(), true); + HdlLogLogic.print("mqtt閾炬帴鎴愬姛---ClientId---" + info.getClientId(), true); } } @Override public void onFailure(HDLException e) { - HdlLogLogic.print("璇诲彇mqtt杩滅▼淇℃伅澶辫触--->" + e.getMessage(), e.getCode(), true); + HdlLogLogic.print("璇诲彇mqtt杩滅▼淇℃伅澶辫触---" + e.getMessage(), e.getCode(), true); } }); } @@ -408,7 +409,7 @@ if (response.getTopic() == null) { return; } - HdlLogLogic.print("C绔�--->鐩戝惉鍒癕odbus鏁版嵁--->" + new Gson().toJson(response), false); + HdlLogLogic.print("C绔�---鐩戝惉鍒癕odbus鏁版嵁---" + new Gson().toJson(response), false); // if (response.getTopic().endsWith("custom/native/inverter/up")) { HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); uniCallBackBaseBean.setType(response.getTopic()); @@ -453,7 +454,18 @@ } + } else if (linkResponse.getTopic().endsWith("/app/thing/property/send")) { + //璁惧鐘舵�佸彉鏇磘opic锛�/user/${homeId}/app/thing/property/send + if (linkResponse.getData() == null) { + HdlLogLogic.print("璁惧鐘舵�佸彉鏇�--->鏁版嵁涓虹┖", false); + return; + } + HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); + uniCallBackBaseBean.setType(linkResponse.getTopic()); + uniCallBackBaseBean.setData(linkResponse.getData()); + HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean); } + } } }; -- Gitblit v1.8.0