| | |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent; |
| | | import com.hdl.sdk.hdl_core.Util.TransformUtil.HDLUtlis; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | |
| | | sensorText.setVisibility(View.GONE); |
| | | |
| | | |
| | | if (appliancesInfo.getCurState() != null) { |
| | | int curLightState = (int) appliancesInfo.getCurState(); |
| | | if (appliancesInfo.getCurStateObject() != null) { |
| | | |
| | | int curLightState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurStateObject()); |
| | | |
| | | lightText.setText("当前灯光亮度:" + curLightState); |
| | | lightBtn.setText("当前灯光亮度:" + curLightState); |
| | |
| | | curtainBtn4.setVisibility(View.GONE); |
| | | curtainBtn5.setVisibility(View.GONE); |
| | | |
| | | if (appliancesInfo.getCurState() != null) { |
| | | if (appliancesInfo.getCurStateObject() != null) { |
| | | String stringCurtainState = ""; |
| | | int curCurtainState = (int) appliancesInfo.getCurState(); |
| | | int curCurtainState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurStateObject()); |
| | | Log.i("djl", "curCurtainState = " + curCurtainState); |
| | | switch (curCurtainState) { |
| | | case CurtainCtrlParser.TYPE_STATE_PAUSE: |
| | |
| | | curText1.setVisibility(View.GONE); |
| | | curtainBtn.setVisibility(View.GONE); |
| | | |
| | | if (appliancesInfo.getCurState() != null) { |
| | | curText2.setText("当前窗帘状态:" + appliancesInfo.getCurState()); |
| | | if (appliancesInfo.getCurStateObject() != null) { |
| | | curText2.setText("当前窗帘状态:" + HDLUtlis.getIntegerByObject(appliancesInfo.getCurStateObject())); |
| | | } else { |
| | | curText2.setText("未获取到窗帘模块状态"); |
| | | } |
| | |
| | | lightText.setVisibility(View.GONE); |
| | | logicBtn.setVisibility(View.GONE); |
| | | logicText.setVisibility(View.GONE); |
| | | if (appliancesInfo.getCurState() != null) { |
| | | float value = (float) appliancesInfo.getCurState(); |
| | | if (appliancesInfo.getCurStateObject() != null) { |
| | | float value = (float) appliancesInfo.getCurStateObject(); |
| | | sensorBtn.setText("传感器数值:" + value); |
| | | } |
| | | break; |
| | |
| | | } |
| | | int tempInt = Integer.parseInt(tempStr); |
| | | |
| | | if (tempInt < 16 || tempInt > 30) { |
| | | showToast("温度设置范围为:16~30摄氏度(℃)"); |
| | | return; |
| | | } |
| | | // if (tempInt < 16 || tempInt > 30) { |
| | | // showToast("温度设置范围为:16~30摄氏度(℃)"); |
| | | // return; |
| | | // } |
| | | |
| | | switch (airModeState) { |
| | | case 0: |
| | |
| | | showToast("获取灯光状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | lightBtn.setText("亮度 = " + event.getAppliancesInfo().getCurState()); |
| | | lightBtn.setText("亮度 = " + HDLUtlis.getIntegerByObject(event.getAppliancesInfo().getCurStateObject())); |
| | | } |
| | | break; |
| | | case HDLApConfig.TYPE_CURTAIN_GLYSTRO: |
| | |
| | | } |
| | | //窗帘模块:curState:0=停止,1=打开,2=关闭。 |
| | | //开合帘电机,卷帘电机:curState:1-100开合度。 |
| | | int curState = (int) event.getAppliancesInfo().getCurState(); |
| | | int curState = HDLUtlis.getIntegerByObject(event.getAppliancesInfo().getCurStateObject()); |
| | | if (event.getAppliancesInfo().getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {//判断是否为窗帘模块,否则为开合帘或卷帘电机 |
| | | switch (curState) { |
| | | case CurtainCtrlParser.curtainOff: |
| | |
| | | showToast("获取传感器---干接点状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float dryContactValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float dryContactValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String dryContactUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---干接点状态:" + dryContactValue + dryContactUnit); |
| | | Log.i("djl", "传感器---干接点状态:" + dryContactValue + dryContactUnit); |
| | |
| | | showToast("获取传感器---移动探测灵敏度状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float mdValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float mdValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String mdValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---移动探测灵敏度:" + mdValue + mdValueUnit); |
| | | Log.i("djl", "传感器---移动探测灵敏度:" + mdValue + mdValueUnit); |
| | |
| | | showToast("获取传感器---温度状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float tempValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float tempValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String tempValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---温度:" + tempValue + tempValueUnit); |
| | | Log.i("djl", "传感器---温度:" + tempValue + tempValueUnit); |
| | |
| | | showToast("获取传感器---湿度状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float humidityValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float humidityValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String humidityValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---湿度:" + humidityValue + humidityValueUnit); |
| | | Log.i("djl", "传感器---湿度:" + humidityValue + humidityValueUnit); |
| | |
| | | showToast("获取传感器---照度状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float illuminaceValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float illuminaceValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String illuminaceValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---照度:" + illuminaceValue + illuminaceValueUnit); |
| | | Log.i("djl", "传感器---照度:" + illuminaceValue + illuminaceValueUnit); |
| | |
| | | showToast("获取传感器---当前空气质量等级状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float vocValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float vocValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String vocValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---当前空气质量等级:" + vocValue + vocValueUnit); |
| | | Log.i("djl", "传感器---当前空气质量等级:" + vocValue + vocValueUnit); |
| | |
| | | showToast("获取传感器---pm2.5状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float pm2_5Value = (float) event.getAppliancesInfo().getCurState(); |
| | | float pm2_5Value = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String pm2_5ValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---pm2.5:" + pm2_5Value + pm2_5ValueUnit); |
| | | Log.i("djl", "传感器---pm2.5:" + pm2_5Value + pm2_5ValueUnit); |
| | |
| | | showToast("获取传感器---二氧化碳状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float co2Value = (float) event.getAppliancesInfo().getCurState(); |
| | | float co2Value = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String co2ValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---二氧化碳:" + co2Value + co2ValueUnit); |
| | | Log.i("djl", "传感器---二氧化碳:" + co2Value + co2ValueUnit); |
| | |
| | | showToast("获取传感器---液化石油气状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float lpgValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float lpgValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String lpgValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---液化石油气:" + lpgValue + lpgValueUnit); |
| | | Log.i("djl", "传感器---液化石油气:" + lpgValue + lpgValueUnit); |
| | |
| | | showToast("获取传感器---人工煤气状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float coh2Value = (float) event.getAppliancesInfo().getCurState(); |
| | | float coh2Value = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String coh2ValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---人工煤气:" + coh2Value + coh2ValueUnit); |
| | | Log.i("djl", "传感器---人工煤气:" + coh2Value + coh2ValueUnit); |
| | |
| | | showToast("获取传感器---天然气状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float ch4Value = (float) event.getAppliancesInfo().getCurState(); |
| | | float ch4Value = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String ch4ValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---天然气:" + ch4Value + ch4ValueUnit); |
| | | Log.i("djl", "传感器---天然气:" + ch4Value + ch4ValueUnit); |
| | |
| | | showToast("获取传感器---烟雾状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float smogValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float smogValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String smogValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---烟雾:" + smogValue + smogValueUnit); |
| | | Log.i("djl", "传感器---烟雾:" + smogValue + smogValueUnit); |
| | |
| | | showToast("获取传感器---风速状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float windSpeedValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float windSpeedValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String windSpeedValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---风速:" + windSpeedValue + windSpeedValueUnit); |
| | | Log.i("djl", "传感器---风速:" + windSpeedValue + windSpeedValueUnit); |
| | |
| | | showToast("获取传感器---风压状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float windPressureValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float windPressureValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String windPressureValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---风压:" + windPressureValue + windPressureValueUnit); |
| | | Log.i("djl", "传感器---风压:" + windPressureValue + windPressureValueUnit); |
| | |
| | | showToast("获取传感器---液体流量状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float liquidFlowValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float liquidFlowValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String liquidFlowValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---液体流量:" + liquidFlowValue + liquidFlowValueUnit); |
| | | Log.i("djl", "传感器---液体流量:" + liquidFlowValue + liquidFlowValueUnit); |
| | |
| | | showToast("获取传感器---液体压力状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float liquidPressureValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float liquidPressureValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String liquidPressureValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---液体压力:" + liquidPressureValue + liquidPressureValueUnit); |
| | | Log.i("djl", "传感器---液体压力:" + liquidPressureValue + liquidPressureValueUnit); |
| | |
| | | showToast("获取传感器---液体深度状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float liquidDepthValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float liquidDepthValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String liquidDepthValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---液体深度:" + liquidDepthValue + liquidDepthValueUnit); |
| | | Log.i("djl", "传感器---液体深度:" + liquidDepthValue + liquidDepthValueUnit); |
| | |
| | | showToast("获取传感器---雨量状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float rainFallValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float rainFallValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String rainFallValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---雨量:" + rainFallValue + rainFallValueUnit); |
| | | Log.i("djl", "传感器---雨量:" + rainFallValue + rainFallValueUnit); |
| | |
| | | showToast("获取传感器---重量状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float weightValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float weightValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String weightValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---重量:" + weightValue + weightValueUnit); |
| | | Log.i("djl", "传感器---重量:" + weightValue + weightValueUnit); |
| | |
| | | showToast("获取传感器---重量状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float height_lengthValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float height_lengthValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String height_lengthValueUnit = ((SensorStateBackInfo) event).getUnite(); |
| | | showToast("传感器---重量:" + height_lengthValue + height_lengthValueUnit); |
| | | Log.i("djl", "传感器---重量:" + height_lengthValue + height_lengthValueUnit); |
| | |
| | | showToast("获取传感器---物体速度状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float objectSpeedValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float objectSpeedValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String objectSpeedUnite = ((SensorStateBackInfo) event).getUnite();//数值单位 |
| | | showToast("传感器---物体速度:" + objectSpeedValue + objectSpeedUnite); |
| | | Log.i("djl", "传感器---物体速度:" + objectSpeedValue + objectSpeedUnite); |
| | |
| | | showToast("获取传感器---震动状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float shakeValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float shakeValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String shakeValueUnite = ((SensorStateBackInfo) event).getUnite();//数值单位 |
| | | showToast("传感器---震动:" + shakeValue + shakeValueUnite); |
| | | Log.i("djl", "传感器---震动:" + shakeValue + shakeValueUnite); |
| | |
| | | showToast("获取传感器---电压状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float voltageValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float voltageValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String voltageValueUnite = ((SensorStateBackInfo) event).getUnite();//数值单位 |
| | | showToast("传感器---电压:" + voltageValue + voltageValueUnite); |
| | | Log.i("djl", "传感器---电压:" + voltageValue + voltageValueUnite); |
| | |
| | | showToast("获取传感器---电流状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float electricityValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float electricityValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String electricityValueUnite = ((SensorStateBackInfo) event).getUnite();//数值单位 |
| | | showToast("传感器---电流:" + electricityValue + electricityValueUnite); |
| | | Log.i("djl", "传感器---电流:" + electricityValue + electricityValueUnite); |
| | |
| | | showToast("获取传感器---功率状态失败,请重新再试"); |
| | | return; |
| | | } |
| | | float powerValue = (float) event.getAppliancesInfo().getCurState(); |
| | | float powerValue = (float) event.getAppliancesInfo().getCurStateObject(); |
| | | String powerValueUnite = ((SensorStateBackInfo) event).getUnite();//数值单位 |
| | | showToast("传感器---功率:" + powerValue + powerValueUnite); |
| | | Log.i("djl", "传感器---功率:" + powerValue + powerValueUnite); |