panlili2024
2024-11-12 69afac92a320033297d71e901e3c5b65e690f0b2
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java
@@ -7,6 +7,7 @@
import com.hdl.sdk.ttl.Config.MCUConstants;
import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirCtrlBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser;
import com.hdl.sdk.ttl.HDLAppliances.HDLAudio.HDLAudio;
import com.hdl.sdk.ttl.HDLAppliances.HDLCommonSwitch.CommonSwitchBackInfo;
@@ -32,6 +33,7 @@
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ScenesData;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.SendDatas;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirTechSysFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ColourLightFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent;
@@ -411,6 +413,47 @@
                        AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
                        airCtrlBackInfo.setAppliancesInfo(info);
                        EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, false));
                    }
                }
            }, mRequestTimeout);
        } else {
            HDLLog.I("空调设备控制不在范围内"
                    + " LittleType = " + info.getLittleType()
                    + " BigType = " + info.getBigType()
            );
        }
    }
    /**
     * 控制空调温度(温度为浮点型)
     *
     * @param info
     * @param type
     * @param temp 温度
     */
    public static void airCtrlTemp(final AppliancesInfo info, int type, float temp) {
        HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
        if (acCtrlFailTimer != null) {
            acCtrlFailTimer.cancel();
            acCtrlFailTimer = null;
        }
        if (info.getBigType() == Configuration.AIR_BIG_TYPE) {
            if (info.getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS) {
                byte[] airbytes = AirCtrlParser.getAirKNXTechAddByte(info, type, temp);
                if (airbytes != null) {
                    addSendData(info, airbytes, Configuration.CONTROL);
                }
            }
            acCtrlFailTimer = new Timer();
            acCtrlFailTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
                        AirTechSysBackInfo AirTechSysBackInfo = new AirTechSysBackInfo(info);
                        EventBus.getDefault().post(new AirTechSysFeedBackEvent(AirTechSysBackInfo, false));
                    }
                }
            }, mRequestTimeout);
@@ -1880,6 +1923,7 @@
            Crc sendDatas = new Crc(command, subnetID, deviceID, addBytes);
            HDLSerialPortCore.sendData(sendDatas);
        } else {
            SendDatas.AddSendData(command, subnetID, deviceID, addBytes);
        }
    }