| | |
| | | package safeluck.drive.evaluation.bean; |
| | | |
| | | import android.content.Context; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import androidx.lifecycle.LiveData; |
| | |
| | | import safeluck.drive.evaluation.viewmodels.MainViewModel; |
| | | |
| | | public class ExamPlatformData { |
| | | |
| | | private static final String TAG = "ExamPlatformData"; |
| | | private static final ExamPlatformData ourInstance = new ExamPlatformData(); |
| | | |
| | | private int exam_id =12345;//考试唯一ID |
| | |
| | | public static final int DEV_REGISTERED = 4; |
| | | public static final int DEV_NOT_LOGIN = 5; |
| | | public static final int DEV_LOGIN = 6; |
| | | |
| | | private boolean isTrainingMode = false;//是否训练模式 |
| | | private static HashMap<Integer,String> examPlatformStrs = new HashMap<>(); |
| | | private List<Integer> sns =new ArrayList<>();//保存所有失败项目的sn |
| | | private static HashMap<Integer,String> enter_exit_item_tts = new HashMap<>(); |
| | | private static List<SimulateNightBean.QuestionBean> simulate_light_tips = new ArrayList<>(); |
| | | static { |
| | |
| | | private int port; |
| | | private String mapPath;//绝对路径包含文件名的path |
| | | private String carPath;//绝对路径包含文件名的path |
| | | private StringBuffer stringBuffer; |
| | | private int rtkPort = 12125; |
| | | private String rtkIP = "47.93.80.84"; |
| | | |
| | | public static ExamPlatformData getInstance() { |
| | | return ourInstance; |
| | |
| | | |
| | | |
| | | private ExamPlatformData() { |
| | | stringBuffer = new StringBuffer(); |
| | | } |
| | | |
| | | public String getPlatformIP(){ |
| | |
| | | public boolean compareIPandPort(String ip,int port){ |
| | | MyLog.i( "compareIPandPort: "+ip+" "+port); |
| | | if(!getPlatformIP().equalsIgnoreCase(ip) || getPlatformPort()!=port){ |
| | | MyLog.i("ip和端口有变化"); |
| | | return true; |
| | | } |
| | | return false; |
| | | } /** |
| | | * 比较RTK ip地址和端口号, |
| | | * @param ip |
| | | * @param port |
| | | * @return ip和端口其中有变化,返回true,否则返回false |
| | | */ |
| | | public boolean compareRTKIPandPort(String ip,int port){ |
| | | MyLog.i( "compareIPandPort: "+ip+" "+port); |
| | | if(!getRtkIP().equalsIgnoreCase(ip) || getRtkPort()!=port){ |
| | | MyLog.i("ip和端口有变化"); |
| | | return true; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public boolean isTrainingMode() { |
| | | isTrainingMode = (boolean) SPUtils.get(app.getAppContext(),SPUtils.TRAIN_MODE,false); |
| | | return isTrainingMode; |
| | | } |
| | | |
| | | public void setTrainingMode(boolean trainingMode) { |
| | | SPUtils.put(app.getAppContext(),SPUtils.TRAIN_MODE,trainingMode); |
| | | isTrainingMode = trainingMode; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.mPhone = phone; |
| | |
| | | public List<SimulateNightBean.QuestionBean> getSimulate_light_tips() { |
| | | return simulate_light_tips; |
| | | } |
| | | |
| | | public List<Integer> getSns() { |
| | | // if (sns.size()<=0){ |
| | | // String snsstr = (String) SPUtils.get(app.getAppContext(),SPUtils.FAIL_PROJ_SNS,""); |
| | | // if (!TextUtils.isEmpty(snsstr)){ |
| | | // String[] strings=snsstr.split("#"); |
| | | // for (int i = 0; i < strings.length; i++) { |
| | | // Log.i(TAG, String.format("strings[%d]=%s",i,strings[i])); |
| | | // if (!TextUtils.isEmpty(strings[i])) |
| | | // sns.add(Integer.parseInt(strings[i])); |
| | | // } |
| | | // } |
| | | // } |
| | | return sns; |
| | | |
| | | } |
| | | |
| | | public void addSn(int sn) { |
| | | // stringBuffer.append("#"+String.valueOf(sn)); |
| | | // SPUtils.put(app.getAppContext(),SPUtils.FAIL_PROJ_SNS,stringBuffer.toString()); |
| | | this.sns.add(sn); |
| | | } |
| | | |
| | | public void clearSns() { |
| | | // SPUtils.clear(app.getAppContext()); |
| | | sns.clear(); |
| | | } |
| | | |
| | | public void setRTKPort(int port) { |
| | | this.rtkPort = port; |
| | | } |
| | | |
| | | public void setRTKIP(String ip) { |
| | | this.rtkIP = ip; |
| | | } |
| | | |
| | | public int getRtkPort() { |
| | | return rtkPort; |
| | | } |
| | | |
| | | public String getRtkIP() { |
| | | return rtkIP; |
| | | } |
| | | } |