| | |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | | import androidx.lifecycle.ViewModelProviders; |
| | | import androidx.work.Data; |
| | | import androidx.work.OneTimeWorkRequest; |
| | | import androidx.work.WorkManager; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Random; |
| | | |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.DB.appstatusdb.AppStatusWorker; |
| | | import safeluck.drive.evaluation.app; |
| | | import safeluck.drive.evaluation.util.SPUtils; |
| | | import safeluck.drive.evaluation.viewmodels.ExamPlatformModel; |
| | |
| | | private static final ExamPlatformData ourInstance = new ExamPlatformData(); |
| | | |
| | | private int exam_id =12345;//考试唯一ID |
| | | |
| | | public static final int TCP_DISCONNECT = 1; |
| | | public static final int TCP_CONNECTED = 2;///2-未连接(tcp连接不上) |
| | | public static final int DEV_NOT_REGISTERED = 3; |
| | | public static final int DEV_REGISTERED = 4; |
| | | public static final int DEV_NOT_LOGIN = 5; |
| | | public static final int DEV_LOGIN = 6; |
| | | private static HashMap<Integer,String> examPlatformStrs = new HashMap<>(); |
| | | static { |
| | | examPlatformStrs.put(TCP_DISCONNECT,"未连接"); |
| | | examPlatformStrs.put(TCP_CONNECTED,"已连接"); |
| | | examPlatformStrs.put(DEV_NOT_REGISTERED,"未注册"); |
| | | examPlatformStrs.put(DEV_REGISTERED,"已注册"); |
| | | examPlatformStrs.put(DEV_NOT_LOGIN,"未登录"); |
| | | examPlatformStrs.put(DEV_LOGIN,"已登录"); |
| | | } |
| | | private static final String WORK_PLATFORM_STATUS = " work_platform"; |
| | | |
| | | |
| | | private int examplatformStatus =1;//1-未连接(tcp连接不上) 3-未注册(设备没有注册) 5-未登录(鉴权未通过) |
| | | |
| | | private String id;//身份证 |
| | | |
| | |
| | | carPath = (String) SPUtils.get(app.getAppContext(),SPUtils.CAR_PATH,""); |
| | | return carPath; |
| | | } |
| | | |
| | | public int getExamplatformStatus() { |
| | | return examplatformStatus; |
| | | } |
| | | |
| | | public void setExamplatformStatus(int examplatformStatus) { |
| | | String[] conn_strs = new String[2]; |
| | | conn_strs[0] = Constant.WORK_PLATFORM_STATUS_COLUMN; |
| | | conn_strs[1] = "{"+WORK_PLATFORM_STATUS+":"+examplatformStatus+"}"; |
| | | //RTK平台连接状态 |
| | | Data connStatusData = new Data.Builder().putStringArray(Constant.APP_STATUS,conn_strs).build(); |
| | | OneTimeWorkRequest oneTimeWorkRequest = new OneTimeWorkRequest.Builder(AppStatusWorker.class). |
| | | setInputData(connStatusData).build(); |
| | | WorkManager.getInstance(app.getAppContext()).enqueue(oneTimeWorkRequest); |
| | | this.examplatformStatus = examplatformStatus; |
| | | } |
| | | |
| | | public String getExamplatformStatusStr(int work_platform) { |
| | | |
| | | return examPlatformStrs.get(work_platform); |
| | | } |
| | | } |