yy1717
2020-03-09 59798b3c20c1b6e7bde1c03cd1caecbaf0860572
app/src/main/java/safeluck/drive/evaluation/bean/ExamPlatformData.java
@@ -10,6 +10,7 @@
import androidx.work.WorkManager;
import com.anyun.exam.lib.MyLog;
import com.anyun.exam.lib.util.Speaker;
import java.util.HashMap;
import java.util.Random;
@@ -33,6 +34,7 @@
    public static final int DEV_NOT_LOGIN = 5;
    public static final int DEV_LOGIN = 6;
    private static HashMap<Integer,String> examPlatformStrs = new HashMap<>();
    private static HashMap<Integer,String> enter_exit_item_tts = new HashMap<>();
    static {
        examPlatformStrs.put(TCP_DISCONNECT,"未连接");
        examPlatformStrs.put(TCP_CONNECTED,"已连接");
@@ -40,6 +42,18 @@
        examPlatformStrs.put(DEV_REGISTERED,"已注册");
        examPlatformStrs.put(DEV_NOT_LOGIN,"未登录");
        examPlatformStrs.put(DEV_LOGIN,"已登录");
/*侧方位停车 type = 3
 倒车入库 type = 1
 上坡起步  type = 2
 zhijiao  type = 5*/
        enter_exit_item_tts.put(1,"倒车入库");
        enter_exit_item_tts.put(2,"坡道定点停车和起步");
        enter_exit_item_tts.put(3,"侧方停车");
        enter_exit_item_tts.put(4,"曲线行驶");
        enter_exit_item_tts.put(5,"直角转弯");
    }
    private static final String WORK_PLATFORM_STATUS = " work_platform";
@@ -47,6 +61,8 @@
    private int examplatformStatus =1;//1-未连接(tcp连接不上)   3-未注册(设备没有注册)   5-未登录(鉴权未通过)
    private String id;//身份证
    private Speaker speaker = null;
    private String ip;
    private int port;
@@ -162,4 +178,36 @@
        return examPlatformStrs.get(work_platform);
    }
    /**
     * 进入退出某个场地的文字
     * @param item
     * @return
     */
    public String getItemStatusStr(int item) {
        if (item<1 || item>enter_exit_item_tts.size()){
            return "未知项目";
        }
        return enter_exit_item_tts.get(item);
    }
    public Speaker getTTS(){
        if (speaker == null){
            throw new RuntimeException("请先初始化TTS,先调用initTTS");
        }else
        return speaker;
    }
    /**
     * 初始化tts
     * @param context
     */
    public void initTTS(Context context){
        if (speaker == null){
            speaker = new Speaker(context);
        }
    }
}