| | |
| | | * @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; |
| | |
| | | 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()); |
| | |
| | | * @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; |
| | |
| | | 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()); |
| | |
| | | * @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; |
| | |
| | | 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)); |
| | |
| | | * @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) { |
| | |
| | | sceneCtrlFailTimer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | if (!HDLDeviceManager.isSceneCtrlSuccess) { |
| | | if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) { |
| | | HDLLog.info("逻辑控制失败"); |
| | | LogicCtrlBackInfo logicCtrlBackInfo = new LogicCtrlBackInfo(); |
| | | logicCtrlBackInfo.setAppliancesInfo(info); |
| | |
| | | * @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; |
| | |
| | | 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)); |
| | |
| | | * @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; |
| | |
| | | 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)); |
| | |
| | | sendCycleTimer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | if (sendDatas.count >= 3) { |
| | | if (sendDatas.count >= 4) { |
| | | sendCycleTimer.cancel(); |
| | | } else { |
| | | // HDLLog.info("控制发送第"+sendDatas.count+ "次"); |
| | |
| | | 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()); |