From 4f841eac608f6f22a573b4f7ed713679e89c2e5b Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 30 九月 2019 13:47:49 +0800
Subject: [PATCH] 2019-9-30 1.修改方案,解决不支持控制5台以上空调问题。

---
 hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java |   80 ++++++++++++++++++++++-----------------
 1 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
index 63bf0e3..2a44bd2 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
@@ -135,7 +135,8 @@
      * @param state
      */
     public static void lightCtrl(final AppliancesInfo info, int state) {
-        HDLDeviceManager.isLightCtrlSuccess = false;
+//        HDLDeviceManager.isLightCtrlSuccess = false;
+        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
         if (lightCtrlFailTimer != null) {
             lightCtrlFailTimer.cancel();
             lightCtrlFailTimer = null;
@@ -179,7 +180,7 @@
         lightCtrlFailTimer.schedule(new TimerTask() {
             @Override
             public void run() {
-                if (!HDLDeviceManager.isLightCtrlSuccess) {
+                if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                     LightCtrlBackInfo lightCtrlBackInfo = new LightCtrlBackInfo();
                     lightCtrlBackInfo.setAppliancesInfo(info);
                     lightCtrlBackInfo.setChannelNum(info.getChannelNum());
@@ -197,7 +198,8 @@
      * @param state
      */
     public static void curtainCtrl(final AppliancesInfo info, int state) {
-        HDLDeviceManager.isCurtainCtrlSuccess = false;
+//        HDLDeviceManager.isCurtainCtrlSuccess = false;
+        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
         if (curtainCtrlFailTimer != null) {
             curtainCtrlFailTimer.cancel();
             curtainCtrlFailTimer = null;
@@ -227,7 +229,7 @@
             curtainCtrlFailTimer.schedule(new TimerTask() {
                 @Override
                 public void run() {
-                    if (!HDLDeviceManager.isCurtainCtrlSuccess) {
+                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                         CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo();
                         curtainCtrlBackInfo.setAppliancesInfo(info);
                         curtainCtrlBackInfo.setNum(info.getChannelNum());
@@ -255,7 +257,8 @@
      * @param state
      */
     public static void airCtrl(final AppliancesInfo info, int type, int state) {
-        HDLDeviceManager.isACCtrlSuccess = false;
+//        HDLDeviceManager.isACCtrlSuccess = false;
+        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
         if (acCtrlFailTimer != null) {
             acCtrlFailTimer.cancel();
             acCtrlFailTimer = null;
@@ -280,7 +283,7 @@
             acCtrlFailTimer.schedule(new TimerTask() {
                 @Override
                 public void run() {
-                    if (!HDLDeviceManager.isACCtrlSuccess) {
+                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                         AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
                         airCtrlBackInfo.setAppliancesInfo(info);
                         EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, false));
@@ -304,7 +307,9 @@
      * @param info
      */
     public static void logicCtrl(final AppliancesInfo info) {
-        HDLDeviceManager.isSceneCtrlSuccess = false;
+//        HDLDeviceManager.isSceneCtrlSuccess = false;
+        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
+
         if (info.getBigType() == Configuration.LOGIC_BIG_TYPE
                 || info.getBigType() == Configuration.GLOBAL_LOGIC_BIG_TYPE) {
             if (info.getLogicMode() == null) {
@@ -324,7 +329,7 @@
             sceneCtrlFailTimer.schedule(new TimerTask() {
                 @Override
                 public void run() {
-                    if (!HDLDeviceManager.isSceneCtrlSuccess) {
+                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                         HDLLog.info("閫昏緫鎺у埗澶辫触");
                         LogicCtrlBackInfo logicCtrlBackInfo = new LogicCtrlBackInfo();
                         logicCtrlBackInfo.setAppliancesInfo(info);
@@ -348,7 +353,8 @@
      * @param state 2019-07-09
      */
     public static void freshAirCtrl(final AppliancesInfo info, int type, int state) {
-        HDLDeviceManager.isFreshAirCtrlSuccess = false;
+//        HDLDeviceManager.isFreshAirCtrlSuccess = false;
+        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
         if (freshAirCtrlFailTimer != null) {
             freshAirCtrlFailTimer.cancel();
             freshAirCtrlFailTimer = null;
@@ -360,7 +366,7 @@
             freshAirCtrlFailTimer.schedule(new TimerTask() {
                 @Override
                 public void run() {
-                    if (!HDLDeviceManager.isFreshAirCtrlSuccess) {
+                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                         FreshAirBackInfo mFreshAirBackInfo = new FreshAirBackInfo();
                         mFreshAirBackInfo.setAppliancesInfo(info);
                         EventBus.getDefault().post(new FreshAirFeedBackEvent(mFreshAirBackInfo, false));
@@ -385,7 +391,8 @@
      * @param state 2019-07-10
      */
     public static void geothermalCtrl(final AppliancesInfo info, int type, int state) {
-        HDLDeviceManager.isGeothermalCtrlSuccess = false;
+//        HDLDeviceManager.isGeothermalCtrlSuccess = false;
+        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
         if (geothermalCtrlFailTimer != null) {
             geothermalCtrlFailTimer.cancel();
             geothermalCtrlFailTimer = null;
@@ -398,7 +405,7 @@
             geothermalCtrlFailTimer.schedule(new TimerTask() {
                 @Override
                 public void run() {
-                    if (!HDLDeviceManager.isGeothermalCtrlSuccess) {
+                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                         GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo();
                         mGeothermalBackInfo.setAppliancesInfo(info);
                         EventBus.getDefault().post(new GeothermalFeedBackEvent(mGeothermalBackInfo, EventCode.FAILURE));
@@ -921,7 +928,7 @@
         sendCycleTimer.schedule(new TimerTask() {
             @Override
             public void run() {
-                if (sendDatas.count >= 3) {
+                if (sendDatas.count >= 4) {
                     sendCycleTimer.cancel();
                 } else {
 //                    HDLLog.info("鎺у埗鍙戦�佺"+sendDatas.count+ "娆�");
@@ -931,29 +938,32 @@
                         sendDatas.isCtrlSuccess = HDLDeviceManager.isGetDeviceStateSuccess;
                     } else if (type == Configuration.CONTROL) {
                         sendDatas.command = info.getCtrlCommand();
-                        switch (info.getBigType()) {
-                            case Configuration.LIGTH_BIG_TYPE:
-                                sendDatas.isCtrlSuccess = HDLDeviceManager.isLightCtrlSuccess;
-                                break;
-                            case Configuration.CURTAIN_BIG_TYPE:
-                                sendDatas.isCtrlSuccess = HDLDeviceManager.isCurtainCtrlSuccess;
-                                break;
-                            case Configuration.AIR_BIG_TYPE:
-                                sendDatas.isCtrlSuccess = HDLDeviceManager.isACCtrlSuccess;
-                                break;
-                            case Configuration.LOGIC_BIG_TYPE:
-                                sendDatas.isCtrlSuccess = HDLDeviceManager.isSceneCtrlSuccess;
-                                break;
-                            case Configuration.GEOTHERMAL_BIG_TYPE://20190710鏂板
-                                sendDatas.isCtrlSuccess = HDLDeviceManager.isGeothermalCtrlSuccess;
-                                break;
-                            case Configuration.FRESH_AIR_BIG_TYPE://20190710鏂板
-                                sendDatas.isCtrlSuccess = HDLDeviceManager.isFreshAirCtrlSuccess;
-                                break;
+                        HDLLog.info("getDeviceKey锛� " + info.getDeviceKey());
+                        sendDatas.isCtrlSuccess = HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info);
 
-                            default:
-                                sendDatas.isCtrlSuccess = false;
-                        }
+//                        switch (info.getBigType()) {
+//                            case Configuration.LIGTH_BIG_TYPE:
+//                                sendDatas.isCtrlSuccess = HDLDeviceManager.isLightCtrlSuccess;
+//                                break;
+//                            case Configuration.CURTAIN_BIG_TYPE:
+//                                sendDatas.isCtrlSuccess = HDLDeviceManager.isCurtainCtrlSuccess;
+//                                break;
+//                            case Configuration.AIR_BIG_TYPE:
+//                                sendDatas.isCtrlSuccess = HDLDeviceManager.isACCtrlSuccess;
+//                                break;
+//                            case Configuration.LOGIC_BIG_TYPE:
+//                                sendDatas.isCtrlSuccess = HDLDeviceManager.isSceneCtrlSuccess;
+//                                break;
+//                            case Configuration.GEOTHERMAL_BIG_TYPE://20190710鏂板
+//                                sendDatas.isCtrlSuccess = HDLDeviceManager.isGeothermalCtrlSuccess;
+//                                break;
+//                            case Configuration.FRESH_AIR_BIG_TYPE://20190710鏂板
+//                                sendDatas.isCtrlSuccess = HDLDeviceManager.isFreshAirCtrlSuccess;
+//                                break;
+//
+//                            default:
+//                                sendDatas.isCtrlSuccess = false;
+//                        }
                     }
                     if (!sendDatas.isCtrlSuccess) {
                         cusSendCommand(sendDatas.command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendDatas.addBytes, info.getPort(), info.getIpAddress());

--
Gitblit v1.8.0