发送设备状态

//每一分钟后沉睡一分钟发送正常设备状态,如果设备状态发生错误,发送错误设备状态,此时发送正常设备状态和发送错误设备状态时间间隔应仍为deviceReportStatusRecycleTime,即更改nextDeviceReportTime为deviceReportStatusRecycleTime

if (nextDeviceReportTime == 0) {
LogManager.get().getLogger(DataSyncService.class).warn("在" + deviceReportStatusRecycleTime + "秒之后,发送设备状态");
TimeUnit.SECONDS.sleep(deviceReportStatusRecycleTime);
EventBus.getDefault().post(new EBDeviceEntity(EVENT_BUS_DEVICE_REPORT_STATUS));
nextDeviceReportTime = deviceReportStatusRecycleTime;
} else {
nextDeviceReportTime--;
TimeUnit.SECONDS.sleep(1);
}
posted @ 2018-05-08 14:27  黄阿火  阅读(221)  评论(0编辑  收藏  举报