From 06faee1a8e8e77835968c55203524dcadc787abf Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 07 九月 2021 17:03:52 +0800
Subject: [PATCH] 2021-09-07 1.之前标准空调模块协议是13位,新的空调回复协议变成长度19位 2.增加单独的播放和暂定指令,解决取反问题

---
 app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlAirActivity.java |  150 ++++++-------------------------------------------
 1 files changed, 19 insertions(+), 131 deletions(-)

diff --git a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlAirActivity.java b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlAirActivity.java
index 847948a..0aa295d 100644
--- a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlAirActivity.java
+++ b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlAirActivity.java
@@ -37,7 +37,7 @@
 
     private Button airBtnSwitch, airBtnMode, airBtnTemp, airBtnSpeed;
     private TextView airText;
-    private TextView tv_switch, tv_mode, tv_speed, tv_tempet;
+    private TextView tv_switch, tv_mode, tv_speed, tv_tempet, tv_indoorTempet;
     private EditText airTempEd;
     private AppliancesInfo appliancesInfo;
 
@@ -46,6 +46,7 @@
     private int airModeState;
     private int airTempState;
     private int airSpeedState;
+    private int indoorTemp;
 //    /**
 //     * true涓鸿缃憚姘忓害 false涓鸿缃崕姘忓害
 //     * 鍙傛暟鑼冨洿 16~30鎽勬皬搴�(鈩�)
@@ -105,7 +106,9 @@
 
     private void displayStateView(){
         switch (appliancesInfo.getDeviceType()) {
-//            case HDLApConfig.TYPE_AC_HVAC:
+            case HDLApConfig.TYPE_AC_HVAC:
+                HDLCommand.getHVACDeviceStateFromNetwork(appliancesInfo);
+                break;
             case HDLApConfig.TYPE_AC_PANEL:
                 loadDeviceData();
                 break;
@@ -128,6 +131,8 @@
         tv_mode = findViewById(R.id.tv_mode);
         tv_speed = findViewById(R.id.tv_speed);
         tv_tempet = findViewById(R.id.tv_tempet);
+
+        tv_indoorTempet = findViewById(R.id.tv_indoorTempet);
     }
 
     private void initOnClick() {
@@ -420,7 +425,7 @@
         ) {
             //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
             switch (event.getAppliancesInfo().getDeviceType()) {
-//                case HDLApConfig.TYPE_AC_HVAC:
+                case HDLApConfig.TYPE_AC_HVAC:
                 case HDLApConfig.TYPE_AC_PANEL:
                     if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
                         if (!event.isSuccess()) {
@@ -429,132 +434,8 @@
                         }
 
                         byte[] curState = event.getAppliancesInfo().getArrCurState();
-
                         readAirState(curState);
-//                        switch (curState[0] & 0xFF) {
-//                            case AirCtrlParser.airSwich:
-//                                switch (curState[1] & 0xFF) {
-//                                    case AirCtrlParser.airOff:
-//                                        airSwitchState = 0;
-//                                        airText.setText("绌鸿皟鍏�");
-//                                        showToast("绌鸿皟鍏�");
-//                                        HDLLog.I("绌鸿皟鍏�");
-//                                        break;
-//                                    case AirCtrlParser.airOn:
-//                                        airSwitchState = 1;
-//                                        airText.setText("绌鸿皟寮�");
-//                                        showToast("绌鸿皟寮�");
-//                                        HDLLog.I("绌鸿皟寮�");
-//                                        break;
-//                                    default:
-//                                        break;
-//                                }
-//
-//                                break;
-//
-//                            case AirCtrlParser.airSpeed:
-//                                switch (curState[1] & 0xFF) {
-//                                    case AirCtrlParser.airSpeedAuto:
-//                                        airSpeedState = 0;
-//                                        airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedAuto鑷姩椋庨��");
-//                                        showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedAuto鑷姩椋庨��");
-//                                        HDLLog.I("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedAuto鑷姩椋庨��");
-//                                        break;
-//                                    case AirCtrlParser.airSpeedHigh:
-//                                        airSpeedState = 1;
-//                                        airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedHigh椋庨�熼珮");
-//                                        showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedHigh椋庨�熼珮");
-//                                        HDLLog.I("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedHigh椋庨�熼珮");
-//                                        break;
-//                                    case AirCtrlParser.airSpeedMid:
-//                                        airSpeedState = 2;
-//                                        airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedMid椋庨�熶腑");
-//                                        showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedMid椋庨�熶腑");
-//                                        HDLLog.I("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedMid椋庨�熶腑");
-//                                        break;
-//                                    case AirCtrlParser.airSpeedLow:
-//                                        airSpeedState = 3;
-//                                        airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedLow椋庨�熶綆");
-//                                        showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedLow椋庨�熶綆");
-//                                        HDLLog.I("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedLow椋庨�熶綆");
-//                                        break;
-//                                    default:
-//                                        break;
-//                                }
-//                                break;
-//                            case AirCtrlParser.airMode:
-//                                switch (curState[1] & 0xFF) {
-//                                    case AirCtrlParser.airModeRefTem:
-//                                        airModeState = 0;
-//                                        airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鍐�");
-//                                        showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鍐�");
-//                                        HDLLog.I("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鍐�");
-//                                        break;
-//                                    case AirCtrlParser.airModeHeatTem:
-//                                        airModeState = 1;
-//                                        airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鐑�");
-//                                        showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鐑�");
-//                                        HDLLog.I("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鐑�");
-//                                        break;
-//                                    case AirCtrlParser.airModeVen:
-//                                        airModeState = 2;
-//                                        airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氶�氶");
-//                                        showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氶�氶");
-//                                        HDLLog.I("绌鸿皟妯″紡锛屾ā寮忎负锛氶�氶");
-//                                        break;
-//                                    case AirCtrlParser.airModeAuto:
-//                                        airModeState = 3;
-//                                        airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氳嚜鍔�");
-//                                        showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氳嚜鍔�");
-//                                        HDLLog.I("绌鸿皟妯″紡锛屾ā寮忎负锛氳嚜鍔�");
-//                                        break;
-//                                    case AirCtrlParser.airModeDehum:
-//                                        airModeState = 4;
-//                                        airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氭娊婀�");
-//                                        showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氭娊婀�");
-//                                        HDLLog.I("绌鸿皟妯″紡锛屾ā寮忎负锛氭娊婀�");
-//                                        break;
-//                                    default:
-//                                        break;
-//                                }
-//                                break;
-//                            case AirCtrlParser.refTem:
-//                                airTempState = curState[1] & 0xFF;
-//                                airText.setText("绌鸿皟鍒跺喎锛屾俯搴︿负锛�" + (curState[1] & 0xFF));
-//                                showToast("绌鸿皟鍒跺喎锛屾俯搴︿负锛�" + (curState[1] & 0xFF));
-//                                HDLLog.I("绌鸿皟鍒跺喎锛屾俯搴︿负锛�" + (curState[1] & 0xFF));
-//                                break;
-//                            case AirCtrlParser.heatTem:
-//                                airTempState = curState[1] & 0xFF;
-//                                airText.setText("绌鸿皟鍒剁儹锛屽埗鐑俯搴︿负" + (curState[1] & 0xFF));
-//                                showToast("绌鸿皟鍒剁儹锛屽埗鐑俯搴︿负" + (curState[1] & 0xFF));
-//                                HDLLog.I("绌鸿皟鍒剁儹锛屽埗鐑俯搴︿负" + (curState[1] & 0xFF));
-//                                break;
-//                            case AirCtrlParser.autoTem:
-//                                airTempState = curState[1] & 0xFF;
-//                                airText.setText("绌鸿皟鑷姩锛岃嚜鍔ㄦ俯搴︿负" + (curState[1] & 0xFF));
-//                                showToast("绌鸿皟鑷姩锛岃嚜鍔ㄦ俯搴︿负" + (curState[1] & 0xFF));
-//                                HDLLog.I("绌鸿皟鑷姩锛岃嚜鍔ㄦ俯搴︿负" + (curState[1] & 0xFF));
-//                                break;
-//                            case AirCtrlParser.dehumTem:
-//                                airTempState = curState[1] & 0xFF;
-//                                airText.setText("绌鸿皟鎶芥箍锛屾娊婀挎俯搴︿负" + (curState[1] & 0xFF));
-//                                showToast("绌鸿皟鎶芥箍锛屾娊婀挎俯搴︿负" + (curState[1] & 0xFF));
-//                                HDLLog.I("绌鸿皟鎶芥箍锛屾娊婀挎俯搴︿负" + (curState[1] & 0xFF));
-//                                break;
-//                            case AirCtrlParser.upTem:
-//                                airTempState = curState[1] & 0xFF;
-//                                airText.setText("绌鸿皟璋冩俯锛屼笂鍗囨俯搴︼細" + (curState[1] & 0xFF));
-//                                showToast("绌鸿皟璋冩俯锛屼笂鍗囨俯搴︼細" + (curState[1] & 0xFF));
-//                                HDLLog.I("绌鸿皟璋冩俯锛屼笂鍗囨俯搴︼細" + (curState[1] & 0xFF));
-//                                break;
-//                            case AirCtrlParser.downTem:
-//                                airTempState = curState[1] & 0xFF;
-//                                airText.setText("绌鸿皟璋冩俯锛屼笅闄嶆俯搴︼細" + (curState[1] & 0xFF));
-//                                showToast("绌鸿皟璋冩俯锛屼笅闄嶆俯搴︼細" + (curState[1] & 0xFF));
-//                                HDLLog.I("绌鸿皟璋冩俯锛屼笅闄嶆俯搴︼細" + (curState[1] & 0xFF));
-//                                break;
-//                        }
+
                     }
                     break;
                 default:
@@ -565,6 +446,8 @@
     }
 
     private void readAirState( byte[] curState ){
+        HDLLog.I("readAirState 妯″紡锛�"+ (curState[0] & 0xFF) + "鐘舵�侊細" +(curState[1] & 0xFF));
+
         String mes = "";
         switch (curState[0] & 0xFF) {
             case AirCtrlParser.airSwich:
@@ -722,7 +605,6 @@
             case AirCtrlParser.upTem:
                 airTempState = curState[1] & 0xFF;
 
-
                 tv_tempet.setText("" + airTempState);
                 mes = "绌鸿皟璋冩俯锛屼笂鍗囨俯搴︼細" + (airTempState);
                 tv_mesSetText(mes);
@@ -735,7 +617,13 @@
                 tv_mesSetText(mes);
                 HDLLog.I(mes);
                 break;
-
+            case AirCtrlParser.airIndoorTemp:
+                indoorTemp = curState[1] & 0xFF;
+                tv_indoorTempet.setText("" + indoorTemp);
+                mes = "褰撳墠瀹ゅ唴娓╁害锛�" + (indoorTemp);
+                tv_mesSetText(mes);
+                HDLLog.I(mes);
+                break;
         }
 
     }
@@ -750,6 +638,6 @@
      */
     private void tv_mesSetText(String mes) {
         airText.setText(mes);
-        showToast(mes);
+//        showToast(mes);
     }
 }

--
Gitblit v1.8.0