From 971a24a9e58a21bc306897fd3ad63012a399f7db Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 23 五月 2025 14:07:18 +0800
Subject: [PATCH] Merge branch '1.2.1' into 1.2.0_google

---
 app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 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 b2db396..0d91bbe 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
@@ -1,6 +1,10 @@
 package com.hdl.photovoltaic.ui;
 
 
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Process;
 import android.os.SystemClock;
@@ -29,6 +33,7 @@
 import com.hdl.photovoltaic.other.HdlResidenceLogic;
 import com.hdl.photovoltaic.other.HdlThreadLogic;
 import com.hdl.photovoltaic.other.HdlUniLogic;
+import com.hdl.photovoltaic.services.ForeService;
 import com.hdl.photovoltaic.ui.bean.DeviceRemoteInfo;
 import com.hdl.photovoltaic.ui.bean.HouseIdBean;
 import com.hdl.photovoltaic.ui.bean.OidBean;
@@ -43,7 +48,7 @@
 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 com.umeng.analytics.MobclickAgent;
 
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
@@ -83,6 +88,19 @@
         this.pushTokens();
         //鑾峰彇浜戠鑴氭湰
         HdlESLocalJsonLogic.getInstance().getAllHdlESLocalJson();
+//        mForegroundService= new Intent(this, ForeService.class);
+//        startService();
+    }
+
+    Intent mForegroundService;
+
+    private void startService() {
+        // Android 8.0浣跨敤startForegroundService鍦ㄥ墠鍙板惎鍔ㄦ柊鏈嶅姟
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            startForegroundService(mForegroundService);
+        } else {
+            startService(mForegroundService);
+        }
     }
 
     @Override
@@ -131,7 +149,7 @@
                 return;
             }
             int index = -1;
-            List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId(), null);
+            List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId());
             for (int i = 0; i < list.size(); i++) {
                 GatewayBean gatewayBean = list.get(i);
                 if (gatewayBean.getGatewayId().equals(topics[2])) {
@@ -205,8 +223,8 @@
             }
             String homeId = event.getData().toString();
             //杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡
-            for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).size(); i++) {
-                String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).get(i).getGatewayId();
+            for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) {
+                String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId();
                 //瀛楃涓叉槸鑷繁鎸夎鍒欐嫾鎺ョ殑,閲岄潰娉ㄥ唽涓婚鏃朵細瑙f瀽瀛楃涓�,鍙嬁getGatewayId()鍊�;
                 String topic = "/user/" + gatewayId + "/#";
                 //杩涘幓浣忓畢璇︽儏寮�濮嬭闃呬富棰�
@@ -231,7 +249,7 @@
 //        }
         if (TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) {
             //鍏跺疄鍒锋柊token澶辫触宸查�氱煡閫�鍑虹櫥褰曪紝鏁版嵁宸茬粡娓呯┖锛屽洜涓虹瓑2s uni鍔犺浇鎱㈠鑷磋姹傞摼鎺ョ殑鏃跺�欏嚭鐜皌oken涓虹┖
-            HdlLogLogic.print("杩斿洖鍘�");
+            HdlLogLogic.print("杩斿洖鍘�---", true);
             return;
         }
         UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(0);
@@ -258,7 +276,9 @@
             String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
             HdlUniLogic.getInstance().openUniMP(path, null);
         }
+
     }
+
 
 //    /**
 //     * 鐗╃悊鎸夐敭杩斿洖浜嬩欢(鍖呮嫭宸︽粦绉婚櫎浜嬩欢)
@@ -294,8 +314,8 @@
                     HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP();
                 }
                 AppManagerUtils.getAppManager().finishAllActivity();
-                //濡傛灉寮�鍙戣�呰皟鐢╧ill鎴栬�卐xit涔嬬被鐨勬柟娉曟潃姝昏繘绋嬶紝鎴栬�呭弻鍑籦ack閿細鏉�姝昏繘绋嬶紝璇峰姟蹇呭湪姝や箣鍓嶈皟鐢∕obclickAgent.onKillProcess鏂规硶锛岀敤鏉ヤ繚瀛樼粺璁℃暟鎹��
-                MobclickAgent.onKillProcess(_mActivity);
+//                //鍙嬬洘sdk濡傛灉寮�鍙戣�呰皟鐢╧ill鎴栬�卐xit涔嬬被鐨勬柟娉曟潃姝昏繘绋嬶紝鎴栬�呭弻鍑籦ack閿細鏉�姝昏繘绋嬶紝璇峰姟蹇呭湪姝や箣鍓嶈皟鐢∕obclickAgent.onKillProcess鏂规硶锛岀敤鏉ヤ繚瀛樼粺璁℃暟鎹��
+//                MobclickAgent.onKillProcess(_mActivity);
                 Process.killProcess(Process.myPid());
             }
         }
@@ -308,6 +328,7 @@
         HdlUniLogic.getInstance().checkRemoveOtherUniMPEventCallBack();
         //绉婚櫎鐩戝惉
         HDLLinkLocalSdk.getInstance().removeAllTopicsListener(allTopicsListener);
+//        stopService(mForegroundService);
     }
 
     /**
@@ -464,6 +485,14 @@
                         uniCallBackBaseBean.setType(linkResponse.getTopic());
                         uniCallBackBaseBean.setData(linkResponse.getData());
                         HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+                    } else if (linkResponse.getTopic().endsWith("custom/wifi/notify")) {
+                        //閫嗗彉鍣ㄨ繛鎺ヨ矾鐢辩姸鎬侀�氱煡
+//                        HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
+//                        uniCallBackBaseBean.setType(linkResponse.getTopic());
+//                        uniCallBackBaseBean.setData(linkResponse.getData());
+//                        HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
+                        HdlLogLogic.print(linkResponse.getTopic() + new Gson().toJson(linkResponse.getData()), true);
+//                        HdlDeviceLogic.getInstance().searchAllNetworkGateway(null);//閫嗗彉鍣╳ifi鐘舵��-閲嶆柊鎼滅储涓�涓嬮�嗗彉鍣�-閲嶆柊鏇存柊杩炴帴鐘舵��
                     }
 
                 }

--
Gitblit v1.8.0