|
@@ -20,7 +20,10 @@ import com.tuya.smartai.iot_sdk.DPEvent;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
public class TuyaUtilsSo {
|
|
@@ -40,7 +43,9 @@ public class TuyaUtilsSo {
|
|
|
public String mAk = "MJhcxmQ6LeZDj1tNu6F5kqK5aQJfpdOb";
|
|
|
public String shorturl = "";
|
|
|
public Context context;
|
|
|
- private static Map<Integer,Integer>map;
|
|
|
+ private boolean isWeight = false;
|
|
|
+ private int heatType = 0;
|
|
|
+ private static Map<Integer, Integer> map;
|
|
|
|
|
|
public static TuyaUtilsSo getInstance() {
|
|
|
if (singleton == null) {
|
|
@@ -173,12 +178,44 @@ public class TuyaUtilsSo {
|
|
|
tuyaEvent(str);
|
|
|
break;
|
|
|
case TuyaSoDp.AUTOMATIC_PROGRAM:
|
|
|
+ /**
|
|
|
+ * -> 自动程序 dpid = 3 ; type = 3 , dp_enum: 0 DIY,1 和面(Knead) ,2 蒸汽(Steam), 3 低温慢煮(Sous_vide) ,4 煮米饭(Rice) ,
|
|
|
+ * 5 搅碎(Chop) , 6 奶昔(Smoothie),7 称重(Weight) ,8 切丁(Dive), 9 去皮(Peeling) ,10 烧水(Boil_water),11 切丝切片 (Food_processor)
|
|
|
+ * 12 自动清洁(Auto_clean) ,13 预加热 (Preheating) , 14 间接性搅拌 (Intermittent_Stir) 15 警告 (Warning)
|
|
|
+ * */
|
|
|
+ //判断是否称重,用来辨别是否需要上报称重数据
|
|
|
+ if (enumValue == 7) {
|
|
|
+ isWeight = true;
|
|
|
+ } else {
|
|
|
+ isWeight = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //加热方式调整
|
|
|
+ if (enumValue==2){
|
|
|
+ heatType = 1;
|
|
|
+ }else if (enumValue==10){
|
|
|
+ heatType = 2;
|
|
|
+ }else {
|
|
|
+ heatType = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//自动程序
|
|
|
getModes(enumValue);
|
|
|
break;
|
|
|
case TuyaSoDp.COOKING_TEMPERATURE:
|
|
|
+ byte mode = HeatModes.PU_TONG;
|
|
|
+ if (heatType==1){
|
|
|
+ mode = HeatModes.ZHENG_QI;
|
|
|
+ }else if (heatType==2){
|
|
|
+ mode = HeatModes.SAP_SHUI;
|
|
|
+ }else {
|
|
|
+ mode =HeatModes.PU_TONG;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//烹饪温度
|
|
|
- CofarSDK.cfgHeat((short) (int) intValue, HeatModes.PU_TONG);
|
|
|
+ CofarSDK.cfgHeat((short) (int) intValue, mode);
|
|
|
tuyaEvent("change_temp");
|
|
|
|
|
|
break;
|
|
@@ -201,7 +238,6 @@ public class TuyaUtilsSo {
|
|
|
break;
|
|
|
case TuyaSoDp.WEIGHT:
|
|
|
//称重功能
|
|
|
-
|
|
|
break;
|
|
|
case TuyaSoDp.SPEED:
|
|
|
//速度
|
|
@@ -232,7 +268,8 @@ public class TuyaUtilsSo {
|
|
|
break;
|
|
|
case TuyaSoDp.CURRENT_ACTIVITY:
|
|
|
//关闭当前页面
|
|
|
- if (boolValue==1){
|
|
|
+ if (boolValue == 1) {
|
|
|
+ isWeight = false;
|
|
|
CommonTuyaSoUtils.INSTANCE.navigateFinish();
|
|
|
}
|
|
|
break;
|
|
@@ -442,55 +479,80 @@ public class TuyaUtilsSo {
|
|
|
int tempChange = 1;
|
|
|
int motorGearChange = 1;
|
|
|
int motorDirectionChange = 1;
|
|
|
- if (mode==null){
|
|
|
- }else {
|
|
|
- timeChange = mode.isTimeChange() ?1:0;
|
|
|
- tempChange = mode.isTempChange()?1:0;
|
|
|
- motorGearChange = mode.isMotorGearChange()?1:0;
|
|
|
- motorDirectionChange = mode.isMotorDirectionChange()?1:0;
|
|
|
+ if (mode == null) {
|
|
|
+ } else {
|
|
|
+ timeChange = mode.isTimeChange() ? 1 : 0;
|
|
|
+ tempChange = mode.isTempChange() ? 1 : 0;
|
|
|
+ motorGearChange = mode.isMotorGearChange() ? 1 : 0;
|
|
|
+ motorDirectionChange = mode.isMotorDirectionChange() ? 1 : 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
int automatic = getModes(info.getRunningInstId());
|
|
|
|
|
|
- DPEvent[] dpEvents = new DPEvent[]{
|
|
|
+// DPEvent[] dpEvents = new DPEvent[]{
|
|
|
+// new DPEvent(TuyaSoDp.ON_OFF, (byte) DPEvent.Type.PROP_BOOL, 1, 0),
|
|
|
+// new DPEvent(TuyaSoDp.START_STOP, (byte) DPEvent.Type.PROP_BOOL, start_stop, 0),
|
|
|
+// new DPEvent(TuyaSoDp.AUTOMATIC_PROGRAM, (byte) DPEvent.Type.PROP_ENUM, automatic, 0),
|
|
|
+// new DPEvent(TuyaSoDp.WORK_STATE, (byte) DPEvent.Type.PROP_ENUM, work_state, 0),
|
|
|
+// new DPEvent(TuyaSoDp.COOKING_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, (int) (info.getTargetTempBuffer() != -1 ? info.getTargetTempBuffer() : info.getTargetTemp()), 0),
|
|
|
+// new DPEvent(TuyaSoDp.CURRENT_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, (int) CofarUtils.parseTemp(info.getTemp()), 0),
|
|
|
+//// new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, 1, 0),
|
|
|
+//// new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE,1, 0),
|
|
|
+//
|
|
|
+// new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getTargetTimeBuffer() != -1 ? info.getTargetTimeBuffer() : info.getTargetTime(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getRemainTime(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.PAUSE, (byte) DPEvent.Type.PROP_BOOL, pause, 0),
|
|
|
+// new DPEvent(TuyaSoDp.SPEED, (byte) DPEvent.Type.PROP_VALUE, (int) (info.getMotorGearBuffer() != -1 ? info.getMotorGearBuffer() : info.getMotorGear()), 0),
|
|
|
+// new DPEvent(TuyaSoDp.REVERSIBLE, (byte) DPEvent.Type.PROP_BOOL, (int) (info.getMotorDirectionBuffer() != -1 ? info.getMotorDirectionBuffer() : info.getMotorDirection()), 0),
|
|
|
+// new DPEvent(TuyaSoDp.POT_STATUS, (byte) DPEvent.Type.PROP_VALUE, pot_status, 0),
|
|
|
+// new DPEvent(TuyaSoDp.WEIGHT_NUMBER, (byte) DPEvent.Type.PROP_VALUE, info.getWeight(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.POT_CLOVER_STATUS, (byte) DPEvent.Type.PROP_VALUE, (int) info.getPotCloverStatus(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.MAX_TIME, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxTime(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.MIN_TIME, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinTime(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxTemp(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.MIN_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinTemp(), 0),
|
|
|
+//
|
|
|
+//// new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : 88, 0),
|
|
|
+//// new DPEvent(TuyaSoDp.MIN_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : 50, 0),
|
|
|
+// new DPEvent(TuyaSoDp.MAX_MOTOR_GEAR, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxMotorGear(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.MIN_MOTOR_GEAR, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinMotorGear(), 0),
|
|
|
+// new DPEvent(TuyaSoDp.TIME_CHANGE, (byte) DPEvent.Type.PROP_BOOL, timeChange, 0),
|
|
|
+// new DPEvent(TuyaSoDp.TEMP_CHANGE, (byte) DPEvent.Type.PROP_BOOL, tempChange, 0),
|
|
|
+// new DPEvent(TuyaSoDp.MOTOR_GEAR_CHANGE, (byte) DPEvent.Type.PROP_BOOL, motorGearChange, 0),
|
|
|
+// new DPEvent(TuyaSoDp.MOTOR_DIRECTION_CHANGE, (byte) DPEvent.Type.PROP_BOOL, motorDirectionChange, 0)
|
|
|
+//
|
|
|
+// };
|
|
|
+
|
|
|
+ List<DPEvent> dpEvents = new ArrayList<>(Arrays.asList(
|
|
|
new DPEvent(TuyaSoDp.ON_OFF, (byte) DPEvent.Type.PROP_BOOL, 1, 0),
|
|
|
new DPEvent(TuyaSoDp.START_STOP, (byte) DPEvent.Type.PROP_BOOL, start_stop, 0),
|
|
|
new DPEvent(TuyaSoDp.AUTOMATIC_PROGRAM, (byte) DPEvent.Type.PROP_ENUM, automatic, 0),
|
|
|
new DPEvent(TuyaSoDp.WORK_STATE, (byte) DPEvent.Type.PROP_ENUM, work_state, 0),
|
|
|
new DPEvent(TuyaSoDp.COOKING_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, (int) (info.getTargetTempBuffer() != -1 ? info.getTargetTempBuffer() : info.getTargetTemp()), 0),
|
|
|
new DPEvent(TuyaSoDp.CURRENT_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, (int) CofarUtils.parseTemp(info.getTemp()), 0),
|
|
|
-// new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, 1, 0),
|
|
|
-// new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE,1, 0),
|
|
|
-
|
|
|
new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getTargetTimeBuffer() != -1 ? info.getTargetTimeBuffer() : info.getTargetTime(), 0),
|
|
|
new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getRemainTime(), 0),
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
new DPEvent(TuyaSoDp.PAUSE, (byte) DPEvent.Type.PROP_BOOL, pause, 0),
|
|
|
new DPEvent(TuyaSoDp.SPEED, (byte) DPEvent.Type.PROP_VALUE, (int) (info.getMotorGearBuffer() != -1 ? info.getMotorGearBuffer() : info.getMotorGear()), 0),
|
|
|
new DPEvent(TuyaSoDp.REVERSIBLE, (byte) DPEvent.Type.PROP_BOOL, (int) (info.getMotorDirectionBuffer() != -1 ? info.getMotorDirectionBuffer() : info.getMotorDirection()), 0),
|
|
|
new DPEvent(TuyaSoDp.POT_STATUS, (byte) DPEvent.Type.PROP_VALUE, pot_status, 0),
|
|
|
- new DPEvent(TuyaSoDp.WEIGHT_NUMBER, (byte) DPEvent.Type.PROP_VALUE, info.getWeight(), 0),
|
|
|
new DPEvent(TuyaSoDp.POT_CLOVER_STATUS, (byte) DPEvent.Type.PROP_VALUE, (int) info.getPotCloverStatus(), 0),
|
|
|
new DPEvent(TuyaSoDp.MAX_TIME, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxTime(), 0),
|
|
|
new DPEvent(TuyaSoDp.MIN_TIME, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinTime(), 0),
|
|
|
new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxTemp(), 0),
|
|
|
new DPEvent(TuyaSoDp.MIN_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinTemp(), 0),
|
|
|
-
|
|
|
-// new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : 88, 0),
|
|
|
-// new DPEvent(TuyaSoDp.MIN_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : 50, 0),
|
|
|
-
|
|
|
new DPEvent(TuyaSoDp.MAX_MOTOR_GEAR, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxMotorGear(), 0),
|
|
|
new DPEvent(TuyaSoDp.MIN_MOTOR_GEAR, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinMotorGear(), 0),
|
|
|
new DPEvent(TuyaSoDp.TIME_CHANGE, (byte) DPEvent.Type.PROP_BOOL, timeChange, 0),
|
|
|
new DPEvent(TuyaSoDp.TEMP_CHANGE, (byte) DPEvent.Type.PROP_BOOL, tempChange, 0),
|
|
|
new DPEvent(TuyaSoDp.MOTOR_GEAR_CHANGE, (byte) DPEvent.Type.PROP_BOOL, motorGearChange, 0),
|
|
|
new DPEvent(TuyaSoDp.MOTOR_DIRECTION_CHANGE, (byte) DPEvent.Type.PROP_BOOL, motorDirectionChange, 0)
|
|
|
+ ));
|
|
|
|
|
|
- };
|
|
|
+ if (isWeight) {
|
|
|
+ dpEvents.add(new DPEvent(TuyaSoDp.WEIGHT_NUMBER, (byte) DPEvent.Type.PROP_VALUE, info.getWeight(), 0))
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -516,10 +578,10 @@ public class TuyaUtilsSo {
|
|
|
}
|
|
|
|
|
|
if (event.type == DPEvent.Type.PROP_BOOL) {
|
|
|
- sendDpBool(event.dpid, value);
|
|
|
+ sendDpBool(event.dpid, value);
|
|
|
}
|
|
|
if (event.type == DPEvent.Type.PROP_VALUE) {
|
|
|
- sendDpValue(event.dpid, value);
|
|
|
+ sendDpValue(event.dpid, value);
|
|
|
}
|
|
|
if (event.type == DPEvent.Type.PROP_STR) {
|
|
|
sendDpStr(event.dpid, String.valueOf(value));
|
|
@@ -535,10 +597,10 @@ public class TuyaUtilsSo {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void sendDevReady(int value){
|
|
|
+ public void sendDevReady(int value) {
|
|
|
// TuyaSoDp.DEV_READY 110
|
|
|
|
|
|
- getTuyaApi().send_dp_value(110, value);
|
|
|
+ getTuyaApi().send_dp_value(110, value);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -582,25 +644,24 @@ public class TuyaUtilsSo {
|
|
|
new DPEvent(TuyaSoDp.START_STOP, (byte) DPEvent.Type.PROP_BOOL, start_stop, 0),
|
|
|
new DPEvent(TuyaSoDp.AUTOMATIC_PROGRAM, (byte) DPEvent.Type.PROP_ENUM, automatic, 0),
|
|
|
new DPEvent(TuyaSoDp.WORK_STATE, (byte) DPEvent.Type.PROP_ENUM, work_state, 0),
|
|
|
- new DPEvent(TuyaSoDp.COOKING_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE,50, 0),
|
|
|
+ new DPEvent(TuyaSoDp.COOKING_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
new DPEvent(TuyaSoDp.CURRENT_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
- new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE,50, 0),
|
|
|
+ new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
|
|
|
// new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getTargetTimeBuffer() != -1 ? info.getTargetTimeBuffer() : info.getTargetTime(), 0),
|
|
|
// new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getRemainTime(), 0),
|
|
|
|
|
|
|
|
|
-
|
|
|
new DPEvent(TuyaSoDp.PAUSE, (byte) DPEvent.Type.PROP_BOOL, pause, 0),
|
|
|
- new DPEvent(TuyaSoDp.SPEED, (byte) DPEvent.Type.PROP_VALUE,2, 0),
|
|
|
- new DPEvent(TuyaSoDp.REVERSIBLE, (byte) DPEvent.Type.PROP_BOOL,1, 0),
|
|
|
+ new DPEvent(TuyaSoDp.SPEED, (byte) DPEvent.Type.PROP_VALUE, 2, 0),
|
|
|
+ new DPEvent(TuyaSoDp.REVERSIBLE, (byte) DPEvent.Type.PROP_BOOL, 1, 0),
|
|
|
new DPEvent(TuyaSoDp.POT_STATUS, (byte) DPEvent.Type.PROP_VALUE, pot_status, 0),
|
|
|
new DPEvent(TuyaSoDp.WEIGHT_NUMBER, (byte) DPEvent.Type.PROP_VALUE, info.getWeight(), 0),
|
|
|
new DPEvent(TuyaSoDp.POT_CLOVER_STATUS, (byte) DPEvent.Type.PROP_VALUE, (int) info.getPotCloverStatus(), 0),
|
|
|
new DPEvent(TuyaSoDp.MAX_TIME, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
new DPEvent(TuyaSoDp.MIN_TIME, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
- new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE,50, 0),
|
|
|
+ new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
new DPEvent(TuyaSoDp.MIN_TEMP, (byte) DPEvent.Type.PROP_VALUE, 50, 0),
|
|
|
|
|
|
// new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : 88, 0),
|
|
@@ -653,10 +714,6 @@ public class TuyaUtilsSo {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
private int getModes(String enumValue) {
|
|
|
/**
|
|
|
* 0 DIY,1 和面(Knead) ,2 蒸汽(Steam), 3 低温慢煮(Sous_vide) ,4 煮米饭(Rice) ,
|
|
@@ -724,25 +781,25 @@ public class TuyaUtilsSo {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void mapClean(){
|
|
|
- if (map!=null){
|
|
|
+ public void mapClean() {
|
|
|
+ if (map != null) {
|
|
|
map.clear();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void sendDpEnum(int dpid, int value) {
|
|
|
Integer mapInt = map.get(dpid);
|
|
|
- if (mapInt!=null){
|
|
|
+ if (mapInt != null) {
|
|
|
int mapValue = mapInt.intValue();
|
|
|
- if (mapValue==value){
|
|
|
+ if (mapValue == value) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- int code = getTuyaApi().send_dp_enum(dpid, value);
|
|
|
+ int code = getTuyaApi().send_dp_enum(dpid, value);
|
|
|
//上报成功,避免同一个值重复上报,估在这加map做缓存
|
|
|
- if (code ==0){
|
|
|
- map.put(dpid,value);
|
|
|
+ if (code == 0) {
|
|
|
+ map.put(dpid, value);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -755,35 +812,35 @@ public class TuyaUtilsSo {
|
|
|
|
|
|
public void sendDpValue(int dpid, int value) {
|
|
|
Integer mapInt = map.get(dpid);
|
|
|
- if (mapInt!=null){
|
|
|
+ if (mapInt != null) {
|
|
|
int mapValue = mapInt.intValue();
|
|
|
- if (mapValue==value){
|
|
|
+ if (mapValue == value) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- int code = getTuyaApi().send_dp_value(dpid, value);
|
|
|
- //上报成功,避免同一个值重复上报,估在这加map做缓存
|
|
|
- if (code ==0){
|
|
|
- map.put(dpid,value);
|
|
|
+ int code = getTuyaApi().send_dp_value(dpid, value);
|
|
|
+ //上报成功,避免同一个值重复上报,估在这加map做缓存
|
|
|
+ if (code == 0) {
|
|
|
+ map.put(dpid, value);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void sendDpBool(int dpid, int value) {
|
|
|
Integer mapInt = map.get(dpid);
|
|
|
- if (mapInt!=null){
|
|
|
+ if (mapInt != null) {
|
|
|
int mapValue = mapInt.intValue();
|
|
|
- if (mapValue==value){
|
|
|
+ if (mapValue == value) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- int code = getTuyaApi().send_dp_bool(dpid, value);
|
|
|
+ int code = getTuyaApi().send_dp_bool(dpid, value);
|
|
|
|
|
|
//上报成功,避免同一个值重复上报,估在这加map做缓存
|
|
|
- if (code ==0){
|
|
|
- map.put(dpid,value);
|
|
|
+ if (code == 0) {
|
|
|
+ map.put(dpid, value);
|
|
|
}
|
|
|
}
|
|
|
|