public enum StatCode { NORMAL(0,"正常"), FLAME_OUT(1,"熄火"), NOT_INSTALL(2,"未安装"), NOT_LOCATE(3,"未定位"), POWER_CUT(4,"断电"), NOT_ONLINE1(11,"离线I"), NOT_ONLINE2(12,"离线II"), NOT_ONLINE3(13,"离线III"), NOT_ONLINE4(14,"离线IV"), NOT_ONLINE5(15,"离线V"); private int code; private String statString; private StatCode(int _code,String _statString) { this.code = _code; this.statString = _statString; } public int getCode() { return code; } public String getStatString() { return statString; } }
import com.yd.lbs.gps.tools.jt808.bodyPartImpl.JT808MsgBody_0x0200; import com.yd.lbs.gps.tools.tanway.entity.VehPackUnit; import com.yd.lbs.gps.tools.util.StatCode; public class VehStatusUtil { public static String getStatus(VehPackUnit vpu) { if (vpu == null) return ""; //断电 if (VpuUtil.validatePowerCut(vpu)) return String.valueOf(StatCode.POWER_CUT.getCode()); //未安装 if (VpuUtil.validateNotInstall(vpu)) return String.valueOf(StatCode.NOT_INSTALL.getCode()); //未定位 if (VpuUtil.validateNotLocate(vpu)) return String.valueOf(StatCode.NOT_LOCATE.getCode()); //熄火 if (VpuUtil.validateFlameout(vpu)) return String.valueOf(StatCode.FLAME_OUT.getCode()); //正常 return String.valueOf(StatCode.NORMAL.getCode()); } public static String getStatus(JT808MsgBody_0x0200 position) { if (position == null) return ""; //断电 if (JT808MsgBody0200Util.validatePowerCut(position)) return String.valueOf(StatCode.POWER_CUT.getCode()); //未安装 if (JT808MsgBody0200Util.validateNotInstall(position)) return String.valueOf(StatCode.NOT_INSTALL.getCode()); //未定位 if (JT808MsgBody0200Util.validateNotLocate(position)) return String.valueOf(StatCode.NOT_LOCATE.getCode()); //熄火 if (JT808MsgBody0200Util.validateFlameout(position)) return String.valueOf(StatCode.FLAME_OUT.getCode()); //正常 return String.valueOf(StatCode.NORMAL.getCode()); } }