| | |
| | | |
| | | 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; |
| | | |
| | |
| | | private int airModeState; |
| | | private int airTempState; |
| | | private int airSpeedState; |
| | | private int indoorTemp; |
| | | // /** |
| | | // * true为设置摄氏度 false为设置华氏度 |
| | | // * 参数范围 16~30摄氏度(℃) |
| | |
| | | |
| | | 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; |
| | |
| | | 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() { |
| | |
| | | ) { |
| | | //这个返回的信息是当前状态的 |
| | | 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()) { |
| | |
| | | } |
| | | |
| | | 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("空调风速,风速模式为:airSpeedAuto自动风速"); |
| | | // showToast("空调风速,风速模式为:airSpeedAuto自动风速"); |
| | | // HDLLog.I("空调风速,风速模式为:airSpeedAuto自动风速"); |
| | | // break; |
| | | // case AirCtrlParser.airSpeedHigh: |
| | | // airSpeedState = 1; |
| | | // airText.setText("空调风速,风速模式为:airSpeedHigh风速高"); |
| | | // showToast("空调风速,风速模式为:airSpeedHigh风速高"); |
| | | // HDLLog.I("空调风速,风速模式为:airSpeedHigh风速高"); |
| | | // break; |
| | | // case AirCtrlParser.airSpeedMid: |
| | | // airSpeedState = 2; |
| | | // airText.setText("空调风速,风速模式为:airSpeedMid风速中"); |
| | | // showToast("空调风速,风速模式为:airSpeedMid风速中"); |
| | | // HDLLog.I("空调风速,风速模式为:airSpeedMid风速中"); |
| | | // break; |
| | | // case AirCtrlParser.airSpeedLow: |
| | | // airSpeedState = 3; |
| | | // airText.setText("空调风速,风速模式为:airSpeedLow风速低"); |
| | | // showToast("空调风速,风速模式为:airSpeedLow风速低"); |
| | | // HDLLog.I("空调风速,风速模式为:airSpeedLow风速低"); |
| | | // 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: |
| | |
| | | } |
| | | |
| | | private void readAirState( byte[] curState ){ |
| | | HDLLog.I("readAirState 模式:"+ (curState[0] & 0xFF) + "状态:" +(curState[1] & 0xFF)); |
| | | |
| | | String mes = ""; |
| | | switch (curState[0] & 0xFF) { |
| | | case AirCtrlParser.airSwich: |
| | |
| | | case AirCtrlParser.upTem: |
| | | airTempState = curState[1] & 0xFF; |
| | | |
| | | |
| | | tv_tempet.setText("" + airTempState); |
| | | mes = "空调调温,上升温度:" + (airTempState); |
| | | tv_mesSetText(mes); |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |