|
|
|
@ -6,6 +6,7 @@ import android.util.Log; |
|
|
|
import com.google.gson.Gson; |
|
|
|
import com.google.gson.reflect.TypeToken; |
|
|
|
import com.sdkapi.api.SdkApi; |
|
|
|
import com.ys.rkapi.MyManager; |
|
|
|
import com.zcapi; |
|
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus; |
|
|
|
@ -33,6 +34,7 @@ public class PowerData extends BaseData { |
|
|
|
public static final String NAME = "heart_beat_data"; |
|
|
|
public static final String POWER_INFO = "power_info"; |
|
|
|
public static String newTimeInfo =""; |
|
|
|
public static String isSetOver =""; |
|
|
|
|
|
|
|
public static void savePowerList(Object value) { |
|
|
|
saveDataJson(NAME, POWER_INFO, new Gson().toJson(value)); |
|
|
|
@ -138,7 +140,27 @@ public class PowerData extends BaseData { |
|
|
|
String dataJson = getDataJson(NAME, POWER_INFO, "{}"); |
|
|
|
// Log.e("tag","设置的定时开关机"+dataJson);
|
|
|
|
if(newTimeInfo.equals(dataJson)){ |
|
|
|
Log.e("PowerData","定时开关机相同"); |
|
|
|
if(Constant.androidBoardType.equals("ys") && "".equals(isSetOver)){ // 亿盛有时候设置开机时间不成功
|
|
|
|
MyManager manager = MyManager.getInstance(MyApplication.getInstance()); |
|
|
|
String onTime = manager.getPowerOnTime(); |
|
|
|
long currentLong = System.currentTimeMillis();//当前时间
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
String setTime = StringUtil.strSplice(dateFormat.format(currentLong), bootTime.replace(":","")); |
|
|
|
String setTime2 = StringUtil.strSplice(dateFormat.format(currentLong+24*60*60*1000), bootTime.replace(":","")); |
|
|
|
|
|
|
|
String s = TimeUtil.stampToDate(currentLong); |
|
|
|
long parameterLong = TimeUtil.pareTLong2(s + " " + parameter);//关机时间
|
|
|
|
long bootLong = TimeUtil.pareTLong2(s + " " + bootTime);//开机时间
|
|
|
|
if(parameterLong>bootLong && onTime.equals(setTime2)){ |
|
|
|
LoggerUtil.e("设置2开机时间:", onTime); |
|
|
|
isSetOver = "over"; |
|
|
|
}else if(parameterLong<bootLong && onTime.equals(setTime)){ |
|
|
|
LoggerUtil.e("设置1开机时间:", onTime); |
|
|
|
isSetOver = "over"; |
|
|
|
}else{ |
|
|
|
newTimeInfo=""; |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
LoggerUtil.e("PowerData","定时开关机不同"); |
|
|
|
@ -161,7 +183,6 @@ public class PowerData extends BaseData { |
|
|
|
LoggerUtil.e("pingNet()", "开机检测网络异常,重启设备"); |
|
|
|
DeviceData.saveDeviceInfo((DeviceData.DEVICE_RESTART_TIME),format); |
|
|
|
SignWayUtil.reboot(); |
|
|
|
|
|
|
|
} |
|
|
|
} ); |
|
|
|
} |
|
|
|
@ -235,11 +256,6 @@ public class PowerData extends BaseData { |
|
|
|
} |
|
|
|
|
|
|
|
}else if(Constant.androidBoardType.equals("ys")){ |
|
|
|
|
|
|
|
//按周:关机时间要在开机时间之后 按天:关机时间在开机时间之前
|
|
|
|
// int[] timeoffArray = { Integer.parseInt(off[0]), Integer.parseInt(off[1])};
|
|
|
|
// int[] timeonArray = {Integer.parseInt(on[0]),Integer.parseInt(on[1])};
|
|
|
|
// SignWayUtil.setPowerOnOffTimeWithWeekFort982(timeonArray,timeoffArray);
|
|
|
|
if(parameterLong > bootLong) { |
|
|
|
//关机时间大于开机时间,第二天开机
|
|
|
|
int[] timeoffArray = {Integer.parseInt(date[0]), Integer.parseInt(date[1]), Integer.parseInt(date[2]), Integer.parseInt(off[0]), Integer.parseInt(off[1])}; |
|
|
|
|