|
@@ -225,7 +225,7 @@ public class TuyaUtilsSo {
|
|
|
isUser = true;
|
|
|
DevInfo infoTemp = CofarSDK.devInfo();
|
|
|
BaseDevMode modesTemp = infoTemp.getMode();
|
|
|
- if (modesTemp.isTempChange()){
|
|
|
+ if (modesTemp.isTempChange()) {
|
|
|
//烹饪温度
|
|
|
CofarSDK.cfgHeat((short) (int) intValue, mode);
|
|
|
tuyaEvent("change_temp");
|
|
@@ -246,14 +246,13 @@ public class TuyaUtilsSo {
|
|
|
isUser = true;
|
|
|
DevInfo infoTime = CofarSDK.devInfo();
|
|
|
BaseDevMode modesTime = infoTime.getMode();
|
|
|
- if (modesTime.isTimeChange()){
|
|
|
+ if (modesTime.isTimeChange()) {
|
|
|
//烹饪时间
|
|
|
CofarSDK.cfgTime((int) intValue);
|
|
|
tuyaEvent("change_time");
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
break;
|
|
|
case TuyaSoDp.WEIGHT:
|
|
|
//称重功能
|
|
@@ -262,7 +261,7 @@ public class TuyaUtilsSo {
|
|
|
isUser = true;
|
|
|
DevInfo infoGear = CofarSDK.devInfo();
|
|
|
BaseDevMode modesGear = infoGear.getMode();
|
|
|
- if (modesGear.isMotorGearChange()){
|
|
|
+ if (modesGear.isMotorGearChange()) {
|
|
|
CofarSDK.cfgMotorGear((byte) intValue);
|
|
|
}
|
|
|
//速度
|
|
@@ -271,7 +270,7 @@ public class TuyaUtilsSo {
|
|
|
isUser = true;
|
|
|
DevInfo info = CofarSDK.devInfo();
|
|
|
BaseDevMode modes = info.getMode();
|
|
|
- if (modes.isMotorDirectionChange()){
|
|
|
+ if (modes.isMotorDirectionChange()) {
|
|
|
//正反转
|
|
|
CofarSDK.cfgMotorDirection((int) boolValue == 0 ? MotorDirections.FORWARD : MotorDirections.REVERSE);
|
|
|
//按照以前的涂鸦,上面修改转向没有图标没有变动,估在发送一个eventbus
|
|
@@ -616,9 +615,6 @@ public class TuyaUtilsSo {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
private int getModes(String enumValue) {
|
|
|
|
|
|
|
|
@@ -828,13 +824,13 @@ public class TuyaUtilsSo {
|
|
|
}
|
|
|
|
|
|
public void setDpCurrentActivity() {
|
|
|
- int time = (int)System.currentTimeMillis();
|
|
|
- getTuyaApi().send_dp_enum(TuyaSoDp.CURRENT_ACTIVITY,1,time);
|
|
|
+ int time = (int) System.currentTimeMillis();
|
|
|
+ getTuyaApi().send_dp_enum(TuyaSoDp.CURRENT_ACTIVITY, 1, time);
|
|
|
}
|
|
|
|
|
|
public void setDpFalse() {
|
|
|
- int time = (int)System.currentTimeMillis();
|
|
|
- getTuyaApi().send_dp_enum(134,0,time);
|
|
|
+ int time = (int) System.currentTimeMillis();
|
|
|
+ getTuyaApi().send_dp_enum(134, 0, time);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -888,17 +884,31 @@ public class TuyaUtilsSo {
|
|
|
// 获取电源管理器的唤醒锁
|
|
|
if (powerManager != null) {
|
|
|
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "MyApp::MyWakelockTag");
|
|
|
+ /*
|
|
|
+ * https://blog.csdn.net/fengyeNom1/article/details/121373158【详解】
|
|
|
+ * 在通常的wakelock使用时,会报错:java.lang.RuntimeException: WakeLock under-locked。
|
|
|
+ * 这是因为出现了上述release函数末尾if(mCount<0)的情,用 setReferenceCounted(false) 就可以解决这个问题。
|
|
|
+ * 这个函数的作用:是不是需要计算锁的数量?设置为false时,在release的时候,不管你acquire()了多少回,可以一次releaseWakeLock掉。
|
|
|
+ *
|
|
|
+ * 注意这个方法默认为true,意味着一个WakeLock调用acquire()多次,也必须release()多次才能释放,
|
|
|
+ * 如果释放次数比acquire()多,则抛出异常: java.lang.RuntimeException: WakeLock under-locked
|
|
|
+ * */
|
|
|
+ wakeLock.setReferenceCounted(false);
|
|
|
// 唤醒屏幕
|
|
|
- wakeLock.acquire(0);
|
|
|
+ try {
|
|
|
+ wakeLock.acquire();
|
|
|
+ // 执行需要锁保持的操作
|
|
|
+ } finally {
|
|
|
+ if (wakeLock.isHeld()) {
|
|
|
+ wakeLock.release();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- if (wakeLock != null && wakeLock.isHeld()) {
|
|
|
- wakeLock.release();
|
|
|
- wakeLock = null;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-}
|
|
|
+ }
|